当前位置: 首页>>代码示例>>C#>>正文


C# XmlWriter.WriteComment方法代码示例

本文整理汇总了C#中System.Xml.XmlWriter.WriteComment方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteComment方法的具体用法?C# XmlWriter.WriteComment怎么用?C# XmlWriter.WriteComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlWriter的用法示例。


在下文中一共展示了XmlWriter.WriteComment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteTo

            internal override void WriteTo(XmlWriter xml)
            {
                if (xml == null)
                    return;

                xml.WriteComment(SR.GetString(SR.ServiceNameFromClient));
                xml.WriteElementString("ServiceName", this.serviceBindingNameSentByClient);

                xml.WriteComment(SR.GetString(SR.ServiceNameOnService));
                xml.WriteStartElement("ServiceNameCollection");
                if (this.serviceNameCollectionConfiguredOnServer == null || this.serviceNameCollectionConfiguredOnServer.Count < 1)
                {
                    xml.WriteElementString("ServiceName", this.defaultServiceBindingNameOfServer);
                }
                else
                {
                    foreach (string serviceName in this.serviceNameCollectionConfiguredOnServer)
                    {
                        xml.WriteElementString("ServiceName", serviceName);
                    }
                }

                xml.WriteFullEndElement();

            }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:SecurityTraceRecordHelper.cs

示例2: EndExport

 protected void EndExport(XmlWriter xmlWriter)
 {
     xmlWriter.WriteEndElement();
     xmlWriter.WriteComment("*************************************");
     xmlWriter.WriteComment(".NET SQL Authorization Manager (Ms-PL)");
     xmlWriter.WriteComment("*************************************");
 }
开发者ID:JamesTryand,项目名称:NetSqlAzMan,代码行数:7,代码来源:dlgExport.aspx.cs

示例3: BeginExport

 protected void BeginExport(XmlWriter xmlWriter)
 {
     xmlWriter.WriteComment("*************************************");
     xmlWriter.WriteComment(".NET SQL Authorization Manager (Ms-PL)");
     xmlWriter.WriteComment("*************************************");
     xmlWriter.WriteComment("http://netsqlazman.codeplex.com");
     xmlWriter.WriteComment("Andrea Ferendeles");
     xmlWriter.WriteComment("*************************************");
     xmlWriter.WriteComment(String.Format("Creation Date: {0}", DateTime.Now.ToString()));
     xmlWriter.WriteComment(String.Format("NetSqlAzMan Run-Time version: {0}", this.storage.GetType().Assembly.GetName().Version.ToString()));
     xmlWriter.WriteComment(String.Format("NetSqlAzMan Database version: {0}", this.storage.DatabaseVesion));
     xmlWriter.WriteComment("*************************************");
     xmlWriter.WriteStartElement("NetSqlAzMan");
 }
开发者ID:JamesTryand,项目名称:NetSqlAzMan,代码行数:14,代码来源:dlgExport.aspx.cs

示例4: Save

		public void Save(object obj, XmlWriter writer)
		{
			Type t = obj.GetType();
		
//			writer.WriteStartElement(GetTypeName(t));
//			System.Console.WriteLine("\tSave <{0}>",GetTypeName(t));
			                        
			writer.WriteStartElement(obj.GetType().Name);
			
			PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(obj);
			PropertyInfo [] propertyInfos = new PropertyInfo[properties.Count];
			
			for (int i = 0;i < properties.Count ; i ++){
				propertyInfos[i] = t.GetProperty(properties[i].Name);
			}
			
			foreach (PropertyInfo info in propertyInfos) {
				if (info ==  null){
					continue;
				}
				if (!info.CanRead) continue;
				
				if (info.GetCustomAttributes(typeof(XmlIgnoreAttribute), true).Length != 0) continue;
				object val = info.GetValue(obj, null);
				if (val == null) continue;
				if (val is ICollection) {
//					PropertyInfo pinfo = t.GetProperty(info.Name);
//					Console.WriteLine("pinfo {0}",pinfo.Name);
					if (info.Name.StartsWith("Contr")) {
						writer.WriteStartElement("Items");
					} else {
					writer.WriteStartElement(info.Name);
					}
					foreach (object element in (ICollection)val) {
						Save(element, writer);
					}
					
					writer.WriteEndElement();
				} else {
					if (!info.CanWrite) continue;
				
					TypeConverter c = TypeDescriptor.GetConverter(info.PropertyType);
					if (c.CanConvertFrom(typeof(string)) && c.CanConvertTo(typeof(string))) {
						try {
							writer.WriteElementString(info.Name, c.ConvertToInvariantString(val));
						} catch (Exception ex) {
							writer.WriteComment(ex.ToString());
						}
					} else if (info.PropertyType == typeof(Type)) {
						writer.WriteElementString(info.Name, ((Type)val).AssemblyQualifiedName);
					} else {
//						System.Diagnostics.Trace.WriteLine("Serialize Pagelayout");
//						writer.WriteStartElement(info.Name);
//						Save(val, writer);
//						writer.WriteEndElement();
					}
				}
			}
			writer.WriteEndElement();
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:60,代码来源:MycroWriter.cs

示例5: WriteXmlLogStart

 public static void WriteXmlLogStart(XmlWriter xw)
 {
     xw.WriteStartDocument();
     xw.WriteStartElement("LogEntries");
     xw.WriteString("\r\n");
     xw.WriteComment(StaticVariables.Logo(false) + "\r\n" + CurrentQuery + "\r\n"); //+ CurrentEntryCount + "\r\n");
 }
开发者ID:BrendanThompson,项目名称:LogQuery,代码行数:7,代码来源:Logs.cs

示例6: WriteNode

 private static void WriteNode(XmlReader reader, XmlWriter writer)
 {
     while (reader.Read())
     {
         switch (reader.NodeType)
         {
         case XmlNodeType.Element:
             writer.WriteStartElement(reader.Name);
             break;
         case XmlNodeType.Text:
             writer.WriteString(reader.Value);
             break;
         case XmlNodeType.CDATA:
             writer.WriteCData(reader.Value);
             break;
         case XmlNodeType.ProcessingInstruction:
             writer.WriteProcessingInstruction(reader.Name, reader.Value);
             break;
         case XmlNodeType.Comment:
             writer.WriteComment(reader.Value);
             break;
         case XmlNodeType.XmlDeclaration:
             break;
         case XmlNodeType.Document:
             break;
         case XmlNodeType.DocumentType:
             break;
         case XmlNodeType.EntityReference:
             break;
         case XmlNodeType.EndElement:
             writer.WriteEndElement();
             break;
         }
     }
 }
开发者ID:platformdotnet,项目名称:Platform,代码行数:35,代码来源:XmlNodeNodeTypeSerializer.cs

示例7: WriteTo

 public override void WriteTo(XmlWriter writer)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     writer.WriteComment(this.value);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XComment.cs

示例8: Write

        /// <summary>
        /// Writes the section using an XML writer
        /// </summary>
        /// <param name="writer">XML writer to use</param>
        /// <param name="project">The project to generate .csproj for</param>
        /// <param name="context">Current .csproj generation context</param>
        public override void Write(XmlWriter writer, Project project, IMSBuildProjectGeneratorContext context)
        {
            writer.WriteStartElement("ItemGroup");

            foreach (var refPath in context.References.Where(IsValidReference))
            {
                if (IsSolutionReference(refPath))
                {
                    var moduleAndprojectName = ((string) refPath).Substring(4);
                    var parts = moduleAndprojectName.Split('#');
                    var moduleName = parts[0];
                    var projectName = parts[1];

                    var referredProject = Suite.GetModule(moduleName).GetProjectOrTestProject(projectName);

                    if (referredProject.Type == ProjectType.Library ||
                        referredProject.Type == ProjectType.Executable)
                    {
                        writer.WriteComment("Project reference " + projectGuidManagement.GetGuid(referredProject));
                        writer.WriteStartElement("Reference");
                        writer.WriteAttributeString("Include", projectName);
                        writer.WriteElementString("HintPath",
                            ToProjectRelativePath(project,
                                Path.Combine(Suite.SuiteRoot.GetRelativePath(targetDir), referredProject.Module.Name,
                                    referredProject.Name + ".dll"), sourceSetName));
                        writer.WriteElementString("SpecificVersion", "False");
                        writer.WriteEndElement();
                    }
                }
                else
                {
                    writer.WriteStartElement("Reference");
                    if (IsGACReference(refPath))
                    {
                        var assemblyName = ((string) refPath).Substring(4);
                        writer.WriteAttributeString("Include", assemblyName);
                    }
                    else
                    {
                        string relativePath = ToProjectRelativePath(project, Path.Combine("target", refPath), sourceSetName);

                        writer.WriteAttributeString("Include", Path.GetFileNameWithoutExtension(relativePath));
                        writer.WriteElementString("HintPath", relativePath);
                        writer.WriteElementString("SpecificVersion", "False");
                        writer.WriteElementString("Private", "True");
                    }
                    writer.WriteEndElement();
                }
            }

            writer.WriteEndElement();
        }
开发者ID:zvrana,项目名称:bari,代码行数:58,代码来源:ReferencesSection.cs

示例9: startLocal

        public static void startLocal() {
            local = true; 
            if (Xmlw == null) {

                 byte[] b = Encoding.UTF8.GetBytes(DateTime.Now.ToString());
                  log = Convert.ToBase64String(b) + ".gh";
           
                Xmlw = XmlWriter.Create(log);

                Xmlw.WriteStartElement("doc");
                Xmlw.WriteComment(DateTime.Now.ToString());
                Xmlw.Flush();
            }      
        }
开发者ID:TheBugMaker,项目名称:Payload-Server,代码行数:14,代码来源:InterceptKeys.cs

示例10: WriteTo

        internal override void WriteTo(XmlWriter writer)
        {
            
            base.WriteTo(writer);

            //
            // canonical element string
            //
            byte[] contentBuffer = _logStream.GetBuffer();
            string contentAsString = System.Text.Encoding.UTF8.GetString(contentBuffer, 0, (int)_logStream.Length);


            writer.WriteElementString(CanonicalElementStringLength, contentAsString.Length.ToString(CultureInfo.InvariantCulture));
            writer.WriteComment(CanonicalElementString + ":" + contentAsString);

            //
            // canonical element base64 format
            //
            writer.WriteElementString(CanonicalOctetsLength, contentBuffer.Length.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString(CanonicalOctets, Convert.ToBase64String(contentBuffer));

            //
            // Hash
            //
            writer.WriteElementString(CanonicalOctetsHashLength, _hash.Hash.Length.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString(CanonicalOctetsHash, Convert.ToBase64String(_hash.Hash));

            //
            // Key: this will only be printed out for the symmetric key case
            //
            if (_hash is KeyedHashAlgorithm)
            {
                KeyedHashAlgorithm keyedHash = _hash as KeyedHashAlgorithm;
                byte[] key = keyedHash.Key;

                writer.WriteStartElement(Key); // start the key element

                writer.WriteElementString(Length, key.Length.ToString(CultureInfo.InvariantCulture)); // key length
                writer.WriteElementString(FirstByte, key[0].ToString(CultureInfo.InvariantCulture)); // first byte of the key
                writer.WriteElementString(LastByte, key[key.Length - 1].ToString(CultureInfo.InvariantCulture)); // last byte of the key

                writer.WriteEndElement();  // close the key element
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:44,代码来源:DigestTraceRecordHelper.cs

示例11: WriteXml

 public void WriteXml(XmlWriter writer)
 {
     var w = new APIWriter(writer);
     writer.WriteComment(DateTime.Now.ToString());
     foreach (var pi in typeof(OnlineRegModel).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                                                   .Where(vv => vv.CanRead && vv.CanWrite))
     {
         switch (pi.Name)
         {
             case "List":
                 w.Start("List");
                 foreach (var i in _list)
                     Util.Serialize(i, writer);
                 w.End();
                 break;
             case "History":
                 w.Start("History");
                 foreach (var i in History)
                     w.Add("item", i);
                 w.End();
                 break;
             case "password":
                 break;
             case "testing":
                 if (testing == true)
                     w.Add(pi.Name, testing);
                 break;
             case "FromMobile":
                 if (FromMobile.HasValue())
                     w.Add(pi.Name, FromMobile);
                 else if (MobileAppMenuController.Source.HasValue())
                     w.Add(pi.Name, MobileAppMenuController.Source);
                 break;
             case "prospect":
                 if (prospect)
                     w.Add(pi.Name, prospect);
                 break;
             default:
                 w.Add(pi.Name, pi.GetValue(this, null));
                 break;
         }
     }
 }
开发者ID:stevesloka,项目名称:bvcms,代码行数:43,代码来源:ReadWriteXml.cs

示例12: WriteActivity

		protected void WriteActivity (XmlWriter _xmlWriter, string _name, string _theme = null, string _orientation = null, string _configChanges = null, string _comment = null)
		{
			if (_comment != null)
				_xmlWriter.WriteComment(_comment);
			
			_xmlWriter.WriteStartElement("activity");
			{
				_xmlWriter.WriteAttributeString("android:name", 					_name);
				
				if (_theme != null)
					_xmlWriter.WriteAttributeString("android:theme", 				_theme);
				
				if (_orientation != null)
					_xmlWriter.WriteAttributeString("android:screenOrientation", 	_orientation);
				
				if (_configChanges != null)
					_xmlWriter.WriteAttributeString("android:configChanges", 		_configChanges);
			}
			_xmlWriter.WriteEndElement();
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:20,代码来源:AndroidManifestGenerator.cs

示例13: WriteTo

 internal override void WriteTo(XmlWriter writer)
 {
     base.WriteTo(writer);
     byte[] bytes = this._logStream.GetBuffer();
     string str = Encoding.UTF8.GetString(bytes, 0, (int) this._logStream.Length);
     writer.WriteElementString("CanonicalElementStringLength", str.Length.ToString(CultureInfo.InvariantCulture));
     writer.WriteComment("CanonicalElementString:" + str);
     writer.WriteElementString("CanonicalOctetsLength", bytes.Length.ToString(CultureInfo.InvariantCulture));
     writer.WriteElementString("CanonicalOctets", Convert.ToBase64String(bytes));
     writer.WriteElementString("CanonicalOctetsHashLength", this._hash.Hash.Length.ToString(CultureInfo.InvariantCulture));
     writer.WriteElementString("CanonicalOctetsHash", Convert.ToBase64String(this._hash.Hash));
     if (this._hash is KeyedHashAlgorithm)
     {
         KeyedHashAlgorithm algorithm = this._hash as KeyedHashAlgorithm;
         byte[] key = algorithm.Key;
         writer.WriteStartElement("Key");
         writer.WriteElementString("Length", key.Length.ToString(CultureInfo.InvariantCulture));
         writer.WriteElementString("FirstByte", key[0].ToString(CultureInfo.InvariantCulture));
         writer.WriteElementString("LastByte", key[key.Length - 1].ToString(CultureInfo.InvariantCulture));
         writer.WriteEndElement();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:DigestTraceRecord.cs

示例14: Save

		public void Save(object obj, XmlWriter writer)
		{
			
			Type t = obj.GetType();
			writer.WriteStartElement(GetTypeName(t));
			foreach (PropertyInfo info in t.GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
				if (!info.CanRead) continue;
				if (info.GetCustomAttributes(typeof(XmlIgnoreAttribute), true).Length != 0) continue;
				object val = info.GetValue(obj, null);
				if (val == null) continue;
				if (val is ICollection) {
					writer.WriteStartElement(info.Name);
					foreach (object element in (ICollection)val) {
						Save(element, writer);
					}
					writer.WriteEndElement();
				} else {
					if (!info.CanWrite) continue;
					TypeConverter c = TypeDescriptor.GetConverter(info.PropertyType);
					if (c.CanConvertFrom(typeof(string)) && c.CanConvertTo(typeof(string))) {
						try {
							writer.WriteElementString(info.Name, c.ConvertToInvariantString(val));
						} catch (Exception ex) {
							writer.WriteComment(ex.ToString());
						}
					} else if (info.PropertyType == typeof(Type)) {
						writer.WriteElementString(info.Name, ((Type)val).AssemblyQualifiedName);
					} else {
						writer.WriteStartElement(info.Name);
						Save(val, writer);
						writer.WriteEndElement();
					}
				}
			}
			writer.WriteEndElement();
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:36,代码来源:MycroWriter.cs

示例15: WriteNode

        private void WriteNode(XmlWriter xtw, bool defattr)
        {
            int num = (this.NodeType == XmlNodeType.None) ? -1 : this.Depth;
            while (this.Read() && (num < this.Depth))
            {
                switch (this.NodeType)
                {
                    case XmlNodeType.Element:
                        xtw.WriteStartElement(this.Prefix, this.LocalName, this.NamespaceURI);
                        ((XmlTextWriter) xtw).QuoteChar = this.QuoteChar;
                        xtw.WriteAttributes(this, defattr);
                        if (this.IsEmptyElement)
                        {
                            xtw.WriteEndElement();
                        }
                        break;

                    case XmlNodeType.Text:
                        xtw.WriteString(this.Value);
                        break;

                    case XmlNodeType.CDATA:
                        xtw.WriteCData(this.Value);
                        break;

                    case XmlNodeType.EntityReference:
                        xtw.WriteEntityRef(this.Name);
                        break;

                    case XmlNodeType.ProcessingInstruction:
                    case XmlNodeType.XmlDeclaration:
                        xtw.WriteProcessingInstruction(this.Name, this.Value);
                        break;

                    case XmlNodeType.Comment:
                        xtw.WriteComment(this.Value);
                        break;

                    case XmlNodeType.DocumentType:
                        xtw.WriteDocType(this.Name, this.GetAttribute("PUBLIC"), this.GetAttribute("SYSTEM"), this.Value);
                        break;

                    case XmlNodeType.Whitespace:
                    case XmlNodeType.SignificantWhitespace:
                        xtw.WriteWhitespace(this.Value);
                        break;

                    case XmlNodeType.EndElement:
                        xtw.WriteFullEndElement();
                        break;
                }
            }
            if ((num == this.Depth) && (this.NodeType == XmlNodeType.EndElement))
            {
                this.Read();
            }
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:57,代码来源:XmlReader.cs


注:本文中的System.Xml.XmlWriter.WriteComment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。