當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlTextWriter.WriteEndAttribute方法代碼示例

本文整理匯總了C#中System.Xml.XmlTextWriter.WriteEndAttribute方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlTextWriter.WriteEndAttribute方法的具體用法?C# XmlTextWriter.WriteEndAttribute怎麽用?C# XmlTextWriter.WriteEndAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.XmlTextWriter的用法示例。


在下文中一共展示了XmlTextWriter.WriteEndAttribute方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: WriteMyAssetSet

        static void WriteMyAssetSet(FileInfo[] files)
        {
            string shortfile;

            XmlTextWriter xmlwriter = new XmlTextWriter("MyAssetSet.xml", null);

            xmlwriter.Formatting = System.Xml.Formatting.Indented;
            xmlwriter.IndentChar = ' ';
            xmlwriter.Indentation = 2;

            xmlwriter.WriteStartElement("Nini");

            foreach (FileInfo f in files)
            {
                shortfile = Path.GetFileNameWithoutExtension(f.FullName);

                xmlwriter.WriteStartElement("Section");
                xmlwriter.WriteStartAttribute("Name");
                xmlwriter.WriteValue(shortfile);
                xmlwriter.WriteEndAttribute();

                WriteKey(xmlwriter, "assetID", shortfile);
                WriteKey(xmlwriter, "name", shortfile);
                WriteKey(xmlwriter, "assetType", "0");
                WriteKey(xmlwriter, "inventoryType", "0");
                WriteKey(xmlwriter, "fileName", f.Name);

                xmlwriter.WriteEndElement();
            }

            xmlwriter.WriteEndElement();
            xmlwriter.Close();
        }
開發者ID:SObS,項目名稱:AssetCompiler,代碼行數:33,代碼來源:AssetCompiler.cs

示例2: WriteXml

		///	<summary>
		///	寫 XML
		///	</summary>
		public void	WriteXml()
		{
			// 構造寫入類.
			// 第一個參數為 文件名
			// 第二個參數為編碼方式.
			XmlTextWriter writer = new XmlTextWriter(XML_FILE_NAME,	Encoding.UTF8);

			//使用自動縮進便於閱讀
			writer.Formatting =	Formatting.Indented;

			// 書寫版本為“1.0”的 XML 聲明
			writer.WriteStartDocument();


			// 寫注釋
			writer.WriteComment("XML文件寫入的例子!");

			//寫入根元素
			writer.WriteStartElement("items");

			// 加入屬性: type="IT"
			writer.WriteStartAttribute("type");
			writer.WriteString("information");
			writer.WriteEndAttribute();

			writer.WriteStartAttribute("keyword");
			writer.WriteString("Database");
			writer.WriteEndAttribute();


			// 加入子元素: <title>SQL Server</title>	這種方式的。
			writer.WriteElementString("title", "SQL	Server");
			writer.WriteElementString("title", "Oracle");
			writer.WriteElementString("title", "MySQL");


			//關閉根元素,並書寫結束標簽
			writer.WriteEndElement();

			// 關閉任何打開的元素或屬性
			writer.WriteEndDocument();

			//將XML寫入文件並且關閉XmlTextWriter
			writer.Close();
		}
開發者ID:mahuidong,項目名稱:my-csharp-sample,代碼行數:48,代碼來源:XmlWriteRead.cs

示例3: SaveToFile

 public void SaveToFile(string text1)
 {
     XmlTextWriter writer = null;
     writer = new XmlTextWriter(text1, Encoding.Default);
     writer.Formatting = Formatting.Indented;
     writer.WriteStartDocument();
     writer.WriteStartElement("root");
     writer.WriteStartElement("BetSuccessSwitching");
     writer.WriteStartAttribute("IsBetSuccessSwitchingEnable");
     writer.WriteValue(Conversion.Val(this._isBetSuccessSwitchingEnable).ToString());
     writer.WriteEndAttribute();
     writer.WriteStartAttribute("BetSuccessSwitchingValue");
     writer.WriteValue(this._objBetSuccessSwitchingOpotion.get_SwitchingValue().ToString());
     writer.WriteEndAttribute();
     writer.WriteEndElement();
     writer.Flush();
     writer.Close();
 }
開發者ID:yjtang,項目名稱:AutoBws,代碼行數:18,代碼來源:AccountSwitchingOptionCollection.cs

示例4: addAtributeToXml

 public void addAtributeToXml(XmlTextWriter t, string name, string text)
 {
     if (text == null)
     {
         text = "";
     }
     t.WriteStartAttribute(name);
     t.WriteString(text);
     t.WriteEndAttribute();
 }
開發者ID:Yaponiz,項目名稱:AdvertBase,代碼行數:10,代碼來源:authuser.cs

示例5: SaveParameters

        public static void SaveParameters()
        {
            try
            {
                XmlTextWriter writer = new XmlTextWriter("params.xml", System.Text.Encoding.UTF8);

                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument();

                writer.WriteStartElement("RegionEditor");

                if (MulPath != "")
                {
                    writer.WriteStartElement("mulpath");

                    writer.WriteStartAttribute("path");
                    writer.WriteValue(_MulPath);
                    writer.WriteEndAttribute();

                    writer.WriteEndElement();
                }

                if (RegionsFile != "")
                {
                    writer.WriteStartElement("script");

                    writer.WriteStartAttribute("file");
                    writer.WriteValue(_RegionsFile);
                    writer.WriteEndAttribute();

                    writer.WriteEndElement();
                }

                if (Compatibility)
                {
                    writer.WriteStartElement("client");

                    writer.WriteStartAttribute("compatibilitymode");
                    writer.WriteValue(Compatibility);
                    writer.WriteEndAttribute();

                    writer.WriteEndElement();
                }

                writer.WriteEndElement();

                writer.WriteEndDocument();

                writer.Close();
            }
            catch { }
        }
開發者ID:frkdom,項目名稱:Region-Editor-2015,代碼行數:52,代碼來源:Parameters.cs

示例6: Save

        public static void Save(string file)
        {
            using (var writer = new XmlTextWriter(file, Encoding.UTF8))
            {
                writer.WriteStartElement("configuration");
                writer.WriteStartElement("connectionstring");
                writer.WriteStartAttribute("ip");
                writer.WriteString(IP);
                writer.WriteEndAttribute();

                writer.WriteStartAttribute("user");
                writer.WriteString(User);
                writer.WriteEndAttribute();

                writer.WriteStartAttribute("password");
                writer.WriteString(Password);
                writer.WriteEndAttribute();

                writer.WriteStartAttribute("database");
                writer.WriteString(Database);
                writer.WriteEndAttribute();
            }
        }
開發者ID:mkozhevnikov,項目名稱:Auto,代碼行數:23,代碼來源:ServerInfo.cs

示例7: writeTicketLoad

        /// <summary>
        /// Constructs the ticket payload.
        /// </summary>
        /// <param name="rootElement"></param>
        /// <param name="ticketType"></param>
        /// <param name="keyValueDictionary"></param>
        /// <returns></returns>
        public string writeTicketLoad(string rootElement, string ticketType, Dictionary<string, object> keyValueDictionary)
        {
            try
            {
                StringWriter stringWriter = new StringWriter();
                XmlTextWriter xmlWriter = new XmlTextWriter(stringWriter);
                //xmlWriter.Formatting = Formatting.Indented;
                //xmlWriter.Indentation = indentation;

                // write root element
                xmlWriter.WriteStartElement(rootElement);
                xmlWriter.WriteAttributeString("xmlns", "ns", null, ticketNS);

                // write ticket type
                xmlWriter.WriteStartAttribute("ticketType");
                xmlWriter.WriteString(ticketType);
                xmlWriter.WriteEndAttribute();

                foreach (string s in keyValueDictionary.Keys)
                {
                    xmlWriter.WriteStartElement(s);
                    object value = new object();
                    keyValueDictionary.TryGetValue(s, out value);
                    xmlWriter.WriteString(value.ToString());
                    xmlWriter.WriteEndElement();
                }

                xmlWriter.WriteEndElement();
                return stringWriter.ToString();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }

            return null;
        }
開發者ID:gumpyoung,項目名稱:ilabproject-code,代碼行數:45,代碼來源:BasicTicketLoadFactory.cs

示例8: WriteMySiteLibraryFolders

        static void WriteMySiteLibraryFolders(string folderID)
        {
            XmlTextWriter xmlwriter = new XmlTextWriter("MySiteLibraryFolders.xml", null);

            xmlwriter.Formatting = System.Xml.Formatting.Indented;
            xmlwriter.IndentChar = ' ';
            xmlwriter.Indentation = 2;

            xmlwriter.WriteStartElement("Nini");
            xmlwriter.WriteStartElement("Section");
            xmlwriter.WriteStartAttribute("Name");
            xmlwriter.WriteValue("MySiteLibraryFolder");
            xmlwriter.WriteEndAttribute();

            WriteKey(xmlwriter, "folderID", folderID);
            WriteKey(xmlwriter, "parentFolderID", "00000112-000f-0000-0000-000100bba000");
            WriteKey(xmlwriter, "name", "MySiteLibraryFolder");
            WriteKey(xmlwriter, "type", "0");

            xmlwriter.WriteEndElement();
            xmlwriter.WriteEndElement();
            xmlwriter.Close();
        }
開發者ID:SObS,項目名稱:AssetCompiler,代碼行數:23,代碼來源:AssetCompiler.cs

示例9: WriteXml

        /// <summary>
        /// 寫xml文件
        /// </summary>
        public static void WriteXml(string shellTypeName,
                                    string basePathDir,
                                    CustomShellType.Basic basicSetting,
                                    CustomShellType.MainCode mainCode,
                                    List<CustomShellType.FuncCode> funcCodeList)
        {
            XmlTextWriter xmlWriter = null;
	        string filename = Path.Combine(basePathDir, shellTypeName);
            try
            {
                xmlWriter = new XmlTextWriter(filename, Encoding.UTF8);
                xmlWriter.Formatting = Formatting.Indented;
                xmlWriter.WriteStartDocument();

                xmlWriter.WriteStartElement("customShellType");
                {
                    //BasicSetting
                    xmlWriter.WriteStartElement("basicSetting");
                    {
                        xmlWriter.WriteStartElement("name");
                        xmlWriter.WriteString(shellTypeName.Substring(0, shellTypeName.Length - 4));
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("serviceExample");
                        xmlWriter.WriteCData(basicSetting.ServiceExample);
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("mainCodeParam");
                        {
                            xmlWriter.WriteStartAttribute("location");
                            xmlWriter.WriteString(basicSetting.MainCodeParam.Location);
                            xmlWriter.WriteEndAttribute();

                            xmlWriter.WriteStartAttribute("encrymode");
                            xmlWriter.WriteString(basicSetting.MainCodeParam.EncryMode.ToString());
                            xmlWriter.WriteEndAttribute();

                            xmlWriter.WriteString(basicSetting.MainCodeParam.Name);
                        }
                        xmlWriter.WriteEndElement();
                    }
                    xmlWriter.WriteEndElement();

                    //MainCodeSetting
                    xmlWriter.WriteStartElement("mainCodeSetting");
                    {
                        xmlWriter.WriteStartElement("funcCodeParam");
                        {
                            xmlWriter.WriteStartAttribute("location");
                            xmlWriter.WriteString(mainCode.FuncCodeParam.Location);
                            xmlWriter.WriteEndAttribute();

                            xmlWriter.WriteStartAttribute("encrymode");
                            xmlWriter.WriteString(mainCode.FuncCodeParam.EncryMode.ToString());
                            xmlWriter.WriteEndAttribute();

                            xmlWriter.WriteString(mainCode.FuncCodeParam.Name);
                        }
                        xmlWriter.WriteEndElement();

                        xmlWriter.WriteStartElement("item");
                        xmlWriter.WriteCData(mainCode.Item);
                        xmlWriter.WriteEndElement();
                    }
                    xmlWriter.WriteEndElement();

                    //FuncCodeSetting
                    xmlWriter.WriteStartElement("funcCodeSetting");
                    {
                        foreach (CustomShellType.FuncCode func in funcCodeList)
                        {
                            xmlWriter.WriteStartElement("func");
                            {
                                xmlWriter.WriteStartElement("name");
                                xmlWriter.WriteString(func.Name);
                                xmlWriter.WriteEndElement();

                                foreach (CustomShellType.ParamStruct par in func.FuncParams)
                                {
                                    xmlWriter.WriteStartElement("funcParameter");
                                    {
                                        xmlWriter.WriteStartAttribute("location");
                                        xmlWriter.WriteString(par.Location);
                                        xmlWriter.WriteEndAttribute();

                                        xmlWriter.WriteStartAttribute("encrymode");
                                        xmlWriter.WriteString(par.EncryMode.ToString());
                                        xmlWriter.WriteEndAttribute();

                                        xmlWriter.WriteString(par.Name);
                                    }
                                    xmlWriter.WriteEndElement();
                                }

                                xmlWriter.WriteStartElement("item");
                                xmlWriter.WriteCData(func.Item);
                                xmlWriter.WriteEndElement();
//.........這裏部分代碼省略.........
開發者ID:kevins1022,項目名稱:Altman,代碼行數:101,代碼來源:CustomShellTypeXmlHandle.cs

示例10: Create

        /// <summary>
        /// Creates a new properties files.
        /// </summary>
        private void Create()
        {
            if (TracingHelper.TraceEnabled)
                TracingHelper.Write(sName);

            XmlTextWriter writer = new XmlTextWriter(sFileProperties, null);
            writer.Formatting = Formatting.Indented;
            writer.Indentation=4;
             		writer.WriteStartDocument();
            writer.WriteComment("SharpHSQL Configuration");
            writer.WriteProcessingInstruction("Instruction","Configuration Record");
            writer.WriteStartElement("Properties","");
            writer.WriteStartAttribute("LogFile","");
            writer.WriteString(sFileScript);
            writer.WriteEndAttribute();
            writer.WriteStartAttribute("DataFile","");
            writer.WriteString(sFileCache);
            writer.WriteEndAttribute();
            writer.WriteStartAttribute("Backup","");
            writer.WriteString(sFileBackup);
            writer.WriteEndAttribute();
            writer.WriteStartAttribute("Version", Assembly.GetExecutingAssembly().GetName().Version.ToString() );
            writer.WriteString("1.0");
            writer.WriteEndAttribute();
            writer.WriteStartAttribute("ReadOnly","");
            writer.WriteString("false");
            writer.WriteEndAttribute();
            writer.WriteStartAttribute("Modified","");
            writer.WriteString("no");
            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Flush();
            writer.Close();

            SaveProperties();
        }
開發者ID:furesoft,項目名稱:SharpHSQL,代碼行數:39,代碼來源:Log.cs

示例11: GenerateXml

        /// Generate Xml Request
        public string GenerateXml()
        {
            string xml;

            StringWriter strStream = new StringWriter();
            XmlTextWriter xmlWriter = new XmlTextWriter(strStream);

            // Start Tag <tag>
            xmlWriter.WriteStartElement(null, this.tag, null);

            // Attributes
            foreach (string key in this.xmlAttributes.Keys) {
                xmlWriter.WriteStartAttribute(null, key, null);
                xmlWriter.WriteString(this.xmlAttributes[key].ToString());
                xmlWriter.WriteEndAttribute();
            }

            // Message Body
            string text = xmlText.ToString();
            if (text != "") {
                string bodyB64 = TextUtils.Base64Encode(text);
                xmlWriter.WriteString(bodyB64);
            }

            // End Tag </tag>
            xmlWriter.WriteEndElement();

            // XML -> String
            xml = strStream.ToString();

            // Close Xml Stream
            xmlWriter.Close();

            return(xml);
        }
開發者ID:BackupTheBerlios,項目名稱:nyfolder-svn,代碼行數:36,代碼來源:XmlRequest.cs

示例12: SaveToFile

 public void SaveToFile(string text1)
 {
     XmlTextWriter writer = null;
     writer = new XmlTextWriter(text1, Encoding.Default);
     writer.Formatting = Formatting.Indented;
     writer.WriteStartDocument();
     writer.WriteStartElement("root");
     foreach (WebsiteBetStyle style in this._objDefaultWebsiteBetStyleList.get_SourceList())
     {
         writer.WriteStartElement("WebsiteBetStyle");
         writer.WriteStartAttribute("Website");
         writer.WriteValue(style.get_Website());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("BetStyle");
         writer.WriteValue(Conversion.Val(style.get_BetStyle()).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("BetValue");
         writer.WriteValue(Conversion.Val(style.get_BetValue()).ToString());
         writer.WriteEndAttribute();
         writer.WriteEndElement();
     }
     writer.WriteStartElement("Range");
     writer.WriteStartAttribute("MemberRange");
     writer.WriteValue(Conversion.Val(this._objMemberRange).ToString());
     writer.WriteEndAttribute();
     writer.WriteEndElement();
     writer.WriteStartElement("GlobalFollowOddsOption");
     writer.WriteStartAttribute("FollowOddsOption");
     writer.WriteValue(Conversion.Val(this._objGlobalFollowOddsOption.get_FollowOddsOption()).ToString());
     writer.WriteEndAttribute();
     writer.WriteStartAttribute("FollowOddsOptionValue");
     writer.WriteValue(this._objGlobalFollowOddsOption.get_OddsValue().ToString());
     writer.WriteEndAttribute();
     writer.WriteEndElement();
     writer.WriteStartElement("GlobalBetFollowMethod");
     writer.WriteStartAttribute("BetFollowMethod");
     writer.WriteValue(Conversion.Val(this._objGlobalBetFollowMethod).ToString());
     writer.WriteEndAttribute();
     writer.WriteEndElement();
     writer.WriteStartElement("GlobalBetTargetCollection");
     writer.WriteStartAttribute("IsToBetAll");
     writer.WriteValue(Conversion.Val(this._objGlobalBetTargetCol.IsToBetAll).ToString());
     writer.WriteEndAttribute();
     writer.WriteStartAttribute("IsToBetFTPut");
     writer.WriteValue(Conversion.Val(this._objGlobalBetTargetCol.IsToBetFTPut).ToString());
     writer.WriteEndAttribute();
     writer.WriteStartAttribute("IsToBetFTEat");
     writer.WriteValue(Conversion.Val(this._objGlobalBetTargetCol.IsToBetFTEat).ToString());
     writer.WriteEndAttribute();
     writer.WriteStartAttribute("IsToBetFTOver");
     writer.WriteValue(Conversion.Val(this._objGlobalBetTargetCol.IsToBetFTOver).ToString());
     writer.WriteEndAttribute();
     writer.WriteStartAttribute("IsToBetFTUnder");
     writer.WriteValue(Conversion.Val(this._objGlobalBetTargetCol.IsToBetFTUnder).ToString());
     writer.WriteEndAttribute();
     writer.WriteStartAttribute("IsToBetHalfPut");
     writer.WriteValue(Conversion.Val(this._objGlobalBetTargetCol.IsToBetHalfPut).ToString());
     writer.WriteEndAttribute();
     writer.WriteStartAttribute("IsToBetHalfEat");
     writer.WriteValue(Conversion.Val(this._objGlobalBetTargetCol.IsToBetHalfEat).ToString());
     writer.WriteEndAttribute();
     writer.WriteStartAttribute("IsToBetHalfOver");
     writer.WriteValue(Conversion.Val(this._objGlobalBetTargetCol.IsToBetHalfOver).ToString());
     writer.WriteEndAttribute();
     writer.WriteStartAttribute("IsToBetHalfUnder");
     writer.WriteValue(Conversion.Val(this._objGlobalBetTargetCol.IsToBetHalfUnder).ToString());
     writer.WriteEndAttribute();
     writer.WriteEndElement();
     writer.WriteStartElement("GlobalMinFollowLimit");
     writer.WriteStartAttribute("MinFollowLimit");
     writer.WriteValue(this._decGlobalMinFollowLimit.ToString());
     writer.WriteEndAttribute();
     writer.WriteEndElement();
     writer.WriteStartElement("GlobalMaxFollowLimit");
     writer.WriteStartAttribute("MaxFollowLimit");
     writer.WriteValue(this._decGlobalMaxFollowLimit.ToString());
     writer.WriteEndAttribute();
     writer.WriteEndElement();
     writer.WriteStartElement("IsGlobalFollowToSameSportBook");
     writer.WriteStartAttribute("IsFollowToSameSportBook");
     writer.WriteValue(Conversion.Val(this._isGlobalFollowToSameSportBook));
     writer.WriteEndAttribute();
     writer.WriteEndElement();
     foreach (Member member in this._objMemberList)
     {
         writer.WriteStartElement("Member");
         writer.WriteStartAttribute("FollowTarget");
         writer.WriteValue(Conversion.Val(member.get_FollowTarget()));
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("Name");
         writer.WriteValue(member.get_Name().ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("AgentFollowOddsOptionType");
         writer.WriteValue(Conversion.Val(member.get_AgentFollowOddsOpt().get_FollowOddsOption()).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("AgentFollowOddsOptionValue");
         writer.WriteValue(member.get_AgentFollowOddsOpt().get_OddsValue().ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("FollowOddsOptionType");
         writer.WriteValue(Conversion.Val(member.get_FollowOddsOpt().get_FollowOddsOption()).ToString());
//.........這裏部分代碼省略.........
開發者ID:yjtang,項目名稱:AutoBws,代碼行數:101,代碼來源:MemberList.cs

示例13: SaveToXmlFile

        /// <summary>
        /// Writing data in an XML format.
        /// </summary>
        /// <param name="fileName"></param>
        private void SaveToXmlFile(string fileName)
        {
            int totalCount = StringRefs.Count();
            int count = 0;
            int lastProgress = -1;
            XmlTextWriter xr = new XmlTextWriter(fileName, Encoding.UTF8);
            xr.Formatting = Formatting.Indented; 
            xr.Indentation = 4;

            xr.WriteStartDocument();
            xr.WriteStartElement("tlkFile");
            xr.WriteAttributeString("TLKToolVersion", App.GetVersion());

            xr.WriteComment("Male entries section begin");

            foreach (var s in StringRefs)
            {
                if (s.position == Header.MaleEntryCount)
                {
                    xr.WriteComment("Male entries section end");
                    xr.WriteComment("Female entries section begin");
                }
                
                xr.WriteStartElement("String");

                xr.WriteStartAttribute("id");
                xr.WriteValue(s.StringID);
                xr.WriteEndAttribute();

                if (s.BitOffset < 0)
                {
                    xr.WriteStartAttribute("calculatedID");
                    xr.WriteValue(-(Int32.MinValue - s.StringID));
                    xr.WriteEndAttribute();

                    xr.WriteString("-1");
                }
                else
                    xr.WriteString(s.Data);

                xr.WriteEndElement(); // </string> 

                int progress = (++count * 100) / totalCount;
                if (progress > lastProgress)
                {
                    lastProgress = progress;
                    OnProgressChanged(lastProgress);
                }
            }
            xr.WriteComment("Female entries section end");
            xr.WriteEndElement(); // </tlkFile>
            xr.Flush();
            xr.Close();
        }
開發者ID:ME3Explorer,項目名稱:ME3Explorer,代碼行數:58,代碼來源:TalkFile.cs

示例14: SaveToFile

        public void SaveToFile(string path)
        {
            /* save the current ParticleSettings to file */
            XmlTextWriter writer = new XmlTextWriter(path, System.Text.Encoding.ASCII);

            writer.WriteStartDocument();
            writer.WriteStartElement("ParticleSystem");

            writer.WriteStartElement("TextureName");
            writer.WriteValue(TextureName);
            writer.WriteEndElement();

            writer.WriteStartElement("MaxParticles");
            writer.WriteValue(MaxParticles);
            writer.WriteEndElement();

            writer.WriteStartElement("Duration");
            writer.WriteValue(Duration.TotalSeconds);
            writer.WriteEndElement();

            writer.WriteStartElement("DurationRandomness");
            writer.WriteValue(DurationRandomness);
            writer.WriteEndElement();

            writer.WriteStartElement("EmitterVelocitySensitivity");
            writer.WriteValue(EmitterVelocitySensitivity);
            writer.WriteEndElement();

            writer.WriteStartElement("MinHorizontalVelocity");
            writer.WriteValue(MinHorizontalVelocity);
            writer.WriteEndElement();

            writer.WriteStartElement("MaxHorizontalVelocity");
            writer.WriteValue(MaxHorizontalVelocity);
            writer.WriteEndElement();

            writer.WriteStartElement("MinVerticalVelocity");
            writer.WriteValue(MinVerticalVelocity);
            writer.WriteEndElement();

            writer.WriteStartElement("MaxVerticalVelocity");
            writer.WriteValue(MaxVerticalVelocity);
            writer.WriteEndElement();

            writer.WriteStartElement("Gravity");

            writer.WriteStartAttribute("x");
            writer.WriteValue(Gravity.X);
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("y");
            writer.WriteValue(Gravity.Y);
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("z");
            writer.WriteValue(Gravity.Z);
            writer.WriteEndAttribute();

            writer.WriteEndElement();

            writer.WriteStartElement("EndVelocity");
            writer.WriteValue(EndVelocity);
            writer.WriteEndElement();

            writer.WriteStartElement("MinColor");

            writer.WriteStartAttribute("r");
            writer.WriteValue(MinColor.R);
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("g");
            writer.WriteValue(MinColor.G);
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("b");
            writer.WriteValue(MinColor.B);
            writer.WriteEndAttribute();

            writer.WriteEndElement();

            writer.WriteStartElement("MaxColor");

            writer.WriteStartAttribute("r");
            writer.WriteValue(MaxColor.R);
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("g");
            writer.WriteValue(MaxColor.G);
            writer.WriteEndAttribute();

            writer.WriteStartAttribute("b");
            writer.WriteValue(MaxColor.B);
            writer.WriteEndAttribute();

            writer.WriteEndElement();

            writer.WriteStartElement("MinRotateSpeed");
            writer.WriteValue(MinRotateSpeed);
            writer.WriteEndElement();

//.........這裏部分代碼省略.........
開發者ID:keaton-freude,項目名稱:DirectedStudy_3DParticles_Freude_Keaton,代碼行數:101,代碼來源:ParticleSettings.cs

示例15: writeInitialAddictionDatabase

        private void writeInitialAddictionDatabase()
        {
            FileInfo fileInfo = new FileInfo(addictionDataPath);
            if (!fileInfo.Exists)
            {
                XmlTextWriter textWriter = new XmlTextWriter(addictionDataPath, null);

                // Opens the document
                textWriter.WriteStartDocument();

                // Write comments
                textWriter.WriteComment("Web addiction data");
                // Write first element
                textWriter.WriteStartElement("WebAddictionRecord");

                textWriter.WriteStartElement("Website");
                textWriter.WriteStartAttribute("Selected");
                textWriter.WriteString("True");
                textWriter.WriteEndAttribute();
                textWriter.WriteString("bbs.sjtu.edu.cn");
                textWriter.WriteEndElement();

                // Ends the document.
                textWriter.WriteEndDocument();
                // close writer
                textWriter.Close();
            }
        }
開發者ID:runoplays,項目名稱:webaddictkiller,代碼行數:28,代碼來源:MainForm.cs


注:本文中的System.Xml.XmlTextWriter.WriteEndAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。