WriteEndAttribute() public method

public WriteEndAttribute ( ) : void
return void
Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
		///	<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();
		}
 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();
 }
Exemplo n.º 4
0
 public void addAtributeToXml(XmlTextWriter t, string name, string text)
 {
     if (text == null)
     {
         text = "";
     }
     t.WriteStartAttribute(name);
     t.WriteString(text);
     t.WriteEndAttribute();
 }
Exemplo n.º 5
0
        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 { }
        }
Exemplo n.º 6
0
        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();
            }
        }
        /// <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;
        }
Exemplo n.º 8
0
        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();
        }
Exemplo n.º 9
0
        /// <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();
                            }
                            xmlWriter.WriteEndElement();
                        }
                    }
                    xmlWriter.WriteEndElement();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                xmlWriter.Close();
            }

        }
Exemplo n.º 10
0
        /// <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();
        }
Exemplo n.º 11
0
        /// 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);
        }
Exemplo n.º 12
0
 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());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("FollowOddsOptionValue");
         writer.WriteValue(member.get_FollowOddsOpt().get_OddsValue().ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("BetFollowMethod");
         writer.WriteValue(Conversion.Val(member.get_BetFollowMethod()).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("MinFollowLimit");
         writer.WriteValue(member.get_MinFollowLimit().ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("MaxFollowLimit");
         writer.WriteValue(member.get_MaxFollowLimit().ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("IsFollowToSameSportBook");
         writer.WriteValue(Conversion.Val(member.get_IsFollowToSameSportBook()));
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("IsToBetAll");
         writer.WriteValue(Conversion.Val(member.get_BetTargetCol().IsToBetAll).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("IsToBetFTPut");
         writer.WriteValue(Conversion.Val(member.get_BetTargetCol().IsToBetFTPut).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("IsToBetFTEat");
         writer.WriteValue(Conversion.Val(member.get_BetTargetCol().IsToBetFTEat).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("IsToBetFTOver");
         writer.WriteValue(Conversion.Val(member.get_BetTargetCol().IsToBetFTOver).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("IsToBetFTUnder");
         writer.WriteValue(Conversion.Val(member.get_BetTargetCol().IsToBetFTUnder).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("IsToBetHalfPut");
         writer.WriteValue(Conversion.Val(member.get_BetTargetCol().IsToBetHalfPut).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("IsToBetHalfEat");
         writer.WriteValue(Conversion.Val(member.get_BetTargetCol().IsToBetHalfEat).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("IsToBetHalfOver");
         writer.WriteValue(Conversion.Val(member.get_BetTargetCol().IsToBetHalfOver).ToString());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("IsToBetHalfUnder");
         writer.WriteValue(Conversion.Val(member.get_BetTargetCol().IsToBetHalfUnder).ToString());
         writer.WriteEndAttribute();
         foreach (WebsiteBetStyle style in member.get_WebsiteBetStyleList().get_SourceList())
         {
             writer.WriteStartElement("MemberWebsiteBetStyle");
             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.WriteEndElement();
     }
     writer.WriteEndElement();
     writer.Flush();
     writer.Close();
     this.ForceWebsiteBetStyleToFixed();
 }
Exemplo n.º 13
0
        /// <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();
        }
        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();

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

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

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

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

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

            writer.WriteStartElement("BlendState");
            writer.WriteValue(this.BlendState.ToString());
            writer.WriteEndElement();

            writer.WriteEndElement();
            writer.WriteEndDocument();

            writer.Close();
        }
Exemplo n.º 15
0
        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();
            }
        }
Exemplo n.º 16
0
		/// <summary>
		/// Saves the listeners to an XML writer.
		/// </summary>
		/// <param name="writer">The XML writer to save the users to.</param>
		private void SaveListeners(XmlTextWriter writer) {
			writer.WriteStartElement("Listeners");
			lock (Parent) {
				for (int i = 0; i < Parent.ListenerCount; i++) {
					writer.WriteStartElement("listener");
					// Write the type, eg 'Org.Mentalis.Proxy.Http.HttpListener'
					writer.WriteStartAttribute("", "type", "");
					writer.WriteString(Parent[i].GetType().FullName);
					writer.WriteEndAttribute();
					// Write the construction string
					writer.WriteStartAttribute("", "value", "");
					writer.WriteString(Parent[i].ConstructString);
					writer.WriteEndAttribute();
					writer.WriteEndElement(); 
				}
			}
			writer.WriteEndElement();
		}
Exemplo n.º 17
0
        // Returns the current element and its descendants or an attribute as a string.
        public virtual string ReadOuterXml() {
            if (ReadState != ReadState.Interactive) {
                return string.Empty;
            }
            if ((this.NodeType != XmlNodeType.Attribute) && (this.NodeType != XmlNodeType.Element)) {
                Read();
                return string.Empty;
            }

            StringWriter sw = new StringWriter(CultureInfo.InvariantCulture);
            XmlTextWriter xtw = new XmlTextWriter(sw);
            try {
                SetNamespacesFlag(xtw);
                if (this.NodeType == XmlNodeType.Attribute) {
                    xtw.WriteStartAttribute(this.Prefix, this.LocalName, this.NamespaceURI);
                    WriteAttributeValue(xtw);
                    xtw.WriteEndAttribute();
                }
                else {
                    xtw.WriteNode(this, false);
                }
            }
            finally {
                xtw.Close();
            }
            return sw.ToString();
        }
Exemplo n.º 18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="obj"></param>
        public static void LLSDWriteOne(XmlTextWriter writer, object obj)
        {
            if (obj == null)
            {
                writer.WriteStartElement(String.Empty, "undef", String.Empty);
                writer.WriteEndElement();
                return;
            }

            if (obj is string)
            {
                writer.WriteStartElement(String.Empty, "string", String.Empty);
                writer.WriteString((string) obj);
                writer.WriteEndElement();
            }
            else if (obj is int)
            {
                writer.WriteStartElement(String.Empty, "integer", String.Empty);
                writer.WriteString(obj.ToString());
                writer.WriteEndElement();
            }
            else if (obj is double)
            {
                writer.WriteStartElement(String.Empty, "real", String.Empty);
                writer.WriteString(obj.ToString());
                writer.WriteEndElement();
            }
            else if (obj is bool)
            {
                bool b = (bool) obj;
                writer.WriteStartElement(String.Empty, "boolean", String.Empty);
                writer.WriteString(b ? "1" : "0");
                writer.WriteEndElement();
            }
            else if (obj is ulong)
            {
                throw new Exception("ulong in LLSD is currently not implemented, fix me!");
            }
            else if (obj is UUID)
            {
                UUID u = (UUID) obj;
                writer.WriteStartElement(String.Empty, "uuid", String.Empty);
                writer.WriteString(u.ToString());
                writer.WriteEndElement();
            }
            else if (obj is Hashtable)
            {
                Hashtable h = obj as Hashtable;
                writer.WriteStartElement(String.Empty, "map", String.Empty);
                foreach (string key in h.Keys)
                {
                    writer.WriteStartElement(String.Empty, "key", String.Empty);
                    writer.WriteString(key);
                    writer.WriteEndElement();
                    LLSDWriteOne(writer, h[key]);
                }
                writer.WriteEndElement();
            }
            else if (obj is ArrayList)
            {
                ArrayList a = obj as ArrayList;
                writer.WriteStartElement(String.Empty, "array", String.Empty);
                foreach (object item in a)
                {
                    LLSDWriteOne(writer, item);
                }
                writer.WriteEndElement();
            }
            else if (obj is byte[])
            {
                byte[] b = obj as byte[];
                writer.WriteStartElement(String.Empty, "binary", String.Empty);

                writer.WriteStartAttribute(String.Empty, "encoding", String.Empty);
                writer.WriteString("base64");
                writer.WriteEndAttribute();

                //// Calculate the length of the base64 output
                //long length = (long)(4.0d * b.Length / 3.0d);
                //if (length % 4 != 0) length += 4 - (length % 4);

                //// Create the char[] for base64 output and fill it
                //char[] tmp = new char[length];
                //int i = Convert.ToBase64CharArray(b, 0, b.Length, tmp, 0);

                //writer.WriteString(new String(tmp));

                writer.WriteString(Convert.ToBase64String(b));
                writer.WriteEndElement();
            }
            else
            {
                throw new LLSDSerializeException("Unknown type " + obj.GetType().Name);
            }
        }
Exemplo n.º 19
0
        public void Scan()
        {
            DirectoryInfo[] albums = null;
            DirectoryInfo root = new DirectoryInfo(this.rootFolder);
            albums = root.GetDirectories();

            //Object, that writes the output file
            XmlTextWriter textWriter = new XmlTextWriter(this.filename, null);
            textWriter.Formatting = Formatting.Indented;
            textWriter.WriteStartElement("featureset");
            foreach (DirectoryInfo d in albums)
            {
                FileInfo[] files = d.GetFiles();

                //Writing new album tag
                textWriter.WriteStartElement("album");
                textWriter.WriteStartAttribute("name");
                textWriter.WriteValue(d.Name);
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("author");
                textWriter.WriteValue(d.Name);
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("imageUrl");
                textWriter.WriteValue("images\\" + d.Name + "\\" + d.Name + ".jpg");
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("link");
                textWriter.WriteValue("#");
                textWriter.WriteEndAttribute();
                foreach (FileInfo file in files)
                {
                    if (file.Extension == ".mp3")
                    {
                        TagLib.File f = TagLib.File.Create(file.FullName);

                        //Writing Song-tag

                        textWriter.WriteStartElement("song");

                        //Writing name attribute
                        textWriter.WriteStartAttribute("name");
                        if (f.Tag.AlbumArtists.Length > 0 && f.Tag.Title != null)
                        {
                            textWriter.WriteValue(f.Tag.AlbumArtists[0] + " - " + f.Tag.Title);
                        }
                        else if (f.Tag.Title != null)
                        {
                            textWriter.WriteValue(f.Tag.Title);
                        }
                        else
                        {
                            textWriter.WriteValue("");
                        }
                        textWriter.WriteEndAttribute();
                        //----------------------------------

                        //writing duration attribute

                        textWriter.WriteStartAttribute("duration");
                        textWriter.WriteValue(f.Properties.Duration.Minutes.ToString() + " : " +
                            f.Properties.Duration.Seconds.ToString());
                        textWriter.WriteEndAttribute();
                        //-------------------------------------------------

                        //writing buy attribute
                        textWriter.WriteStartAttribute("buy");
                        textWriter.WriteValue("false");
                        textWriter.WriteEndAttribute();
                        //--------------------------------

                        //writing download attribute
                        textWriter.WriteStartAttribute("download");
                        textWriter.WriteValue(true);
                        textWriter.WriteEndAttribute();
                        //--------------------------------

                        //writing buyLink attribute
                        textWriter.WriteStartAttribute("buyLink");
                        textWriter.WriteValue("http://www.flabell.com");
                        textWriter.WriteEndAttribute();
                        //--------------------------------

                        //writing downloadSource attribute
                        textWriter.WriteStartAttribute("downloadSource");
                        textWriter.WriteValue("player/songs/" + file.Name);
                        textWriter.WriteEndAttribute();
                        //--------------------------------

                        textWriter.WriteValue("songs/" + file.Name);

                        textWriter.WriteEndElement();
                    }
                }
                //textWriter.WriteEndAttribute();
                textWriter.WriteEndElement();
            }
            textWriter.WriteEndElement();
            textWriter.Close();
        }
Exemplo n.º 20
0
 public void SaveToFile(string text1)
 {
     XmlTextWriter writer = null;
     writer = new XmlTextWriter(text1, Encoding.Default);
     writer.Formatting = Formatting.Indented;
     writer.WriteStartDocument();
     writer.WriteStartElement("root");
     foreach (AccountInformation information in this._objList)
     {
         writer.WriteStartElement("AccountInfo");
         writer.WriteStartAttribute("AccountID");
         writer.WriteValue(information.get_AccountID());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("AccountPassword");
         writer.WriteValue(information.get_AccountPassword());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("LoginURL");
         writer.WriteValue(information.get_LoginURL());
         writer.WriteEndAttribute();
         writer.WriteStartAttribute("Role");
         writer.WriteValue(Conversion.Val(information.get_Role()));
         writer.WriteEndAttribute();
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
     writer.Flush();
     writer.Close();
 }
Exemplo n.º 21
0
        private void CommandBinding_NewCmdExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            MogitorsRoot mogRoot = MogitorsRoot.Instance;
            if (!(mogRoot.TerminateScene()))
                return;

            ProjectOptions opt = mogRoot.ProjectOptions;
            opt.IsNewProject = true;
            opt.ProjectName = "";
            opt.ProjectDir = MogitorsSystem.Instance.ProjectsDirectory;
            opt.SceneManagerName = "OctreeSceneManager";
            opt.TerrainDirectory = "Terrain";
            opt.ResourceDirectories.Clear();
            opt.Cameras.Clear();
            opt.SelectionBBColourForSerializer = Color.FromRgb(255, 255, 255);
            opt.HighlightBBColourForSerializer = Color.FromRgb(232, 48, 48);

            SettingsDialog dlg = new SettingsDialog(opt);
            if (dlg.ShowDialog() == true)
            {
                string fileName = MogitorsSystem.Instance.CombinePath(mogRoot.ProjectOptions.ProjectDir, mogRoot.ProjectOptions.ProjectName + ".mogscene");
                fileName = MogitorsSystem.Instance.GetFullPath(fileName);

                XmlTextWriter textWriter = new XmlTextWriter(fileName, System.Text.Encoding.Unicode);
                textWriter.Formatting = Formatting.Indented;
                textWriter.WriteStartDocument();

                // XML Root
                textWriter.WriteStartElement("MogitorScene");

                // Write project options
                mogRoot.WriteProjectOptions(textWriter, true);

                // Write new scene definition
                textWriter.WriteStartElement("Object");
                textWriter.WriteStartAttribute("Type");
                textWriter.WriteValue(mogRoot.ProjectOptions.SceneManagerName);
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("SceneManagerType");
                textWriter.WriteValue(mogRoot.ProjectOptions.SceneManagerName);
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("Name");
                textWriter.WriteValue("SceneManager");
                textWriter.WriteEndAttribute();
                textWriter.WriteStartAttribute("Ambient");
                textWriter.WriteValue("1.000 1.000 1.000");
                textWriter.WriteEndAttribute();
                textWriter.WriteEndElement();

                textWriter.WriteEndElement();
                textWriter.WriteEndDocument();
                textWriter.Close();

                mogRoot.LoadScene(fileName);
            }

            this.statusString.Text = "New scene created";
        }
Exemplo n.º 22
0
        public void SaveToXml(string _FileName)
        {
            XmlTextWriter writer = null;
            try
            {
                writer = new XmlTextWriter(_FileName,null);
                writer.WriteStartDocument();
                writer.WriteStartElement("Accounts");
                for (int i = 0; i < accounts.Count; i++)
                {
                    writer.WriteStartElement("Account");

                    writer.WriteStartAttribute("id");
                    writer.WriteString(accounts[i].accountNumber);
                    writer.WriteEndAttribute();
                    writer.WriteStartElement("accountPIN");
                    writer.WriteString(accounts[i].accountPIN);
                    writer.WriteEndElement();
                    writer.WriteStartElement("accountTotalBalance");
                    writer.WriteString(accounts[i].accountPIN);
                    writer.WriteEndElement();
                    writer.WriteStartElement("accountAvailableBalance");
                    writer.WriteString(accounts[i].accountPIN);
                    writer.WriteEndElement();
                    writer.WriteEndElement();

                }
            }
            catch (Exception e)
            {
            }
            finally
            {
                writer.WriteEndElement();
                writer.Flush();
                writer.Close();
            }
        }
Exemplo n.º 23
0
        private void GenerateSiteMap(HttpContext context)
        {
            context.Response.Cache.SetExpires(DateTime.Now.AddMinutes(20));
            context.Response.Cache.SetCacheability(HttpCacheability.Public);

            context.Response.ContentType = "application/xml";
            Encoding encoding = new UTF8Encoding();
            context.Response.ContentEncoding = encoding;

            using (XmlTextWriter xmlTextWriter = new XmlTextWriter(context.Response.OutputStream, encoding))
            {

                xmlTextWriter.Formatting = Formatting.Indented;

                xmlTextWriter.WriteStartDocument();

                xmlTextWriter.WriteStartElement("urlset");
                xmlTextWriter.WriteStartAttribute("xmlns");
                xmlTextWriter.WriteValue("http://www.sitemaps.org/schemas/sitemap/0.9");
                xmlTextWriter.WriteEndAttribute();

                AddUrls(context, xmlTextWriter);

                xmlTextWriter.WriteEndElement(); //urlset

                //end of document
                xmlTextWriter.WriteEndDocument();

            }
        }
Exemplo n.º 24
0
		private void WriteXMLAttribute(string AttrName, string AttrValue, XmlTextWriter xmlOutput)
		{
			xmlOutput.WriteStartAttribute(AttrName);
			xmlOutput.WriteString(AttrValue);
			xmlOutput.WriteEndAttribute();
		}
Exemplo n.º 25
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="data"></param>
        public static void SerializeLLSDXmlElement(XmlTextWriter writer, OSD data)
        {
            switch (data.Type)
            {
                case OSDType.Unknown:
                    writer.WriteStartElement(String.Empty, "undef", String.Empty);
                    writer.WriteEndElement();
                    break;
                case OSDType.Boolean:
                    writer.WriteStartElement(String.Empty, "boolean", String.Empty);
                    writer.WriteString(data.AsString());
                    writer.WriteEndElement();
                    break;
                case OSDType.Integer:
                    writer.WriteStartElement(String.Empty, "integer", String.Empty);
                    writer.WriteString(data.AsString());
                    writer.WriteEndElement();
                    break;
                case OSDType.Real:
                    writer.WriteStartElement(String.Empty, "real", String.Empty);
                    writer.WriteString(data.AsString());
                    writer.WriteEndElement();
                    break;
                case OSDType.String:
                    writer.WriteStartElement(String.Empty, "string", String.Empty);
                    writer.WriteString(data.AsString());
                    writer.WriteEndElement();
                    break;
                case OSDType.Guid:
                    writer.WriteStartElement(String.Empty, "Guid", String.Empty);
                    writer.WriteString(data.AsString());
                    writer.WriteEndElement();
                    break;
                case OSDType.Date:
                    writer.WriteStartElement(String.Empty, "date", String.Empty);
                    writer.WriteString(data.AsString());
                    writer.WriteEndElement();
                    break;
                case OSDType.URI:
                    writer.WriteStartElement(String.Empty, "uri", String.Empty);
                    writer.WriteString(data.AsString());
                    writer.WriteEndElement();
                    break;
                case OSDType.Binary:
                    writer.WriteStartElement(String.Empty, "binary", String.Empty);
                        writer.WriteStartAttribute(String.Empty, "encoding", String.Empty);
                        writer.WriteString("base64");
                        writer.WriteEndAttribute();
                    writer.WriteString(data.AsString());
                    writer.WriteEndElement();
                    break;
                case OSDType.Map:
                    OSDMap map = (OSDMap)data;
                    writer.WriteStartElement(String.Empty, "map", String.Empty);
                    foreach (KeyValuePair<string, OSD> kvp in map)
                    {
                        writer.WriteStartElement(String.Empty, "key", String.Empty);
                        writer.WriteString(kvp.Key);
                        writer.WriteEndElement();

                        SerializeLLSDXmlElement(writer, kvp.Value);
                    }
                    writer.WriteEndElement();
                    break;
                case OSDType.Array:
                    OSDArray array = (OSDArray)data;
                    writer.WriteStartElement(String.Empty, "array", String.Empty);
                    for (int i = 0; i < array.Count; i++)
                    {
                        SerializeLLSDXmlElement(writer, array[i]);
                    }
                    writer.WriteEndElement();
                    break;
            }
        }
Exemplo n.º 26
0
		/// <summary>
		/// Saves the data in this class to an XML file.
		/// </summary>
		public void SaveData() {
			XmlTextWriter writer = null;
			try {
				writer = new XmlTextWriter(File, Encoding.ASCII);
				writer.Indentation = 2;
				writer.Formatting = Formatting.Indented;
				writer.WriteStartElement("MentalisProxy"); 
				// Write the version
				writer.WriteStartElement("Version");
				writer.WriteStartAttribute("", "value", "");
				writer.WriteString(Assembly.GetCallingAssembly().GetName().Version.ToString(2));
				writer.WriteEndAttribute();
				writer.WriteEndElement(); 
				// Write the settings
				SaveSettings(writer);
				// Write the Authentication list to the file
				SaveUsers(writer);
				// Write the Listeners list to the file
				SaveListeners(writer);
				// Clean up
				writer.WriteEndElement(); 
			} catch {
			} finally {
				if (writer != null)
					writer.Close();
			}
		}
Exemplo n.º 27
0
        /// <summary>
        /// Save database properties.
        /// </summary>
        private void SaveProperties()
        {
            lock( SyncLock )
            {
                //WATYF:
                //Added check for ".new" file, delete if exists.
                //Changed writer creation to include ".new" suffix on sFileProperties
                FileInfo fi = new FileInfo(sFileProperties + ".new");
                if ( fi.Exists ){ fi.Delete();}

                XmlTextWriter writer = new XmlTextWriter(sFileProperties + ".new", 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","");
                writer.WriteString(sVersion);
                writer.WriteEndAttribute();
                writer.WriteStartAttribute("ReadOnly","");
                if (bReadOnly == true)
                {
                    writer.WriteString("true");
                }
                else
                {
                    writer.WriteString("false");
                }
                writer.WriteEndAttribute();
                writer.WriteStartAttribute("Modified","");
                writer.WriteString(sModified);
                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Flush();
                writer.Close();

                //WATYF: Added RenameNewToCurrent
                RenameNewToCurrent(sFileProperties);

                CloseProperties();

                if (TracingHelper.TraceEnabled)
                    TracingHelper.Write();
            }
        }
Exemplo n.º 28
0
		/// <summary>
		/// Saves the settings in this class to an XML writer.
		/// </summary>
		/// <param name="writer">The XML writer to save the data to.</param>
		private void SaveSettings(XmlTextWriter writer) {
			writer.WriteStartElement("Settings");
			string [] keys = new string[Settings.Count];
			Settings.Keys.CopyTo(keys, 0);
			for (int i = 0; i < keys.Length; i++) {
				writer.WriteStartElement(keys[i]);
				writer.WriteStartAttribute("", "value", "");
				writer.WriteString(Settings[keys[i]]);
				writer.WriteEndAttribute();
				writer.WriteEndElement(); 
			}
			writer.WriteEndElement(); 
		}
Exemplo n.º 29
0
 public void SaveToFile(string text1)
 {
     XmlTextWriter writer = null;
     writer = new XmlTextWriter(text1, Encoding.Default);
     writer.Formatting = Formatting.Indented;
     writer.WriteStartDocument();
     writer.WriteStartElement("root");
     foreach (string str in this._objList)
     {
         writer.WriteStartElement("StringList");
         writer.WriteStartAttribute("Value");
         writer.WriteValue(str);
         writer.WriteEndAttribute();
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
     writer.Flush();
     writer.Close();
 }
Exemplo n.º 30
0
		/// <summary>
		/// Saves the authentication list to an XML writer.
		/// </summary>
		/// <param name="writer">The XML writer to save the users to.</param>
		private void SaveUsers(XmlTextWriter writer) {
			writer.WriteStartElement("Users");
			string [] keys = UserList.Keys;
			string [] hashes = UserList.Hashes;
			for (int i = 0; i < keys.Length; i++) {
				writer.WriteStartElement(keys[i]);
				writer.WriteStartAttribute("", "value", "");
				writer.WriteString(hashes[i]);
				writer.WriteEndAttribute();
				writer.WriteEndElement(); 
			}
			writer.WriteEndElement(); 
		}