Inheritance: XmlReader, IXmlLineInfo
        public static IncomingTransportMessage Deserialize(string messageId, Stream inputStream)
        {
            var headers = new Dictionary<string, string>();
            var serializedMessageData = "";
            using (var reader = new XmlTextReader(inputStream))
            {
                reader.WhitespaceHandling = WhitespaceHandling.None;
                reader.Read(); // read <root>
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        var elementName = reader.Name;
                        reader.Read(); // read the child;
                        while (reader.NodeType == XmlNodeType.Element)
                        {
                            // likely an empty header element node
                            headers.Add(elementName, reader.Value);

                            elementName = reader.Name;
                            reader.Read(); // read the child;
                        }
                        if (string.Equals(elementName, "body", StringComparison.InvariantCultureIgnoreCase) && reader.NodeType == XmlNodeType.CDATA)
                        {
                            serializedMessageData = reader.Value;
                        }
                        else if (reader.NodeType == XmlNodeType.Text)
                        {
                            headers.Add(elementName, reader.Value);
                        }
                    }
                }
            }
            return new IncomingTransportMessage(messageId, headers, serializedMessageData);
        }
Example #2
1
        public AvatarAnimations()
        {
            using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(reader);
                foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
                {
                    if (nod.Attributes["name"] != null)
                    {
                        string name = nod.Attributes["name"].Value;
                        UUID id = (UUID) nod.InnerText;
                        string animState = nod.Attributes["state"].Value;

                        try
                        {
                            AnimsUUID.Add(name, id);
                            if (animState != "" && !AnimStateNames.ContainsKey(id))
                                AnimStateNames.Add(id, animState);
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
        private static StringBuilder Transform(string gcmlPath)
        {
            if(!File.Exists(gcmlPath))
            {
                throw new GCMLFileNotFoundException("The GCML File" + gcmlPath + " does not exist.");
            }

            if(!File.Exists(xsltFilePath))
            {
                throw new XSLTFileNotFoundException("The XSLT File" + xsltFilePath + " does not exist.");
            }

            StringBuilder sb = new StringBuilder();
            XmlTextReader xmlSource = new XmlTextReader(gcmlPath);
            XPathDocument xpathDoc = new XPathDocument(xmlSource);
            XslCompiledTransform xsltDoc = new XslCompiledTransform();

            xsltDoc.Load(xsltFilePath);

            StringWriter sw = new StringWriter(sb);
            try
            {
                xsltDoc.Transform(xpathDoc, null, sw);
            }
            catch (XsltException except)
            {
                Console.WriteLine(except.Message);
                throw except;
            }

            return sb;
        }
 public RepertoireRepository()
 {
     XmlReader reader = new XmlTextReader(path);
     List<TheaterRepertoire> filereprt = (List<TheaterRepertoire>)writers.Deserialize(reader);
     reader.Close();
     this.repertoiresList = filereprt;
 }
Example #5
0
 private void advanceToElement(ref XmlTextReader reader, string element)
 {
     while (!reader.Name.EndsWith(element))
     {
         reader.Read();
     }
 }
Example #6
0
 private static void LoadChannels()
 {
     XmlReader reader = new XmlTextReader("channel.xml");
     while (reader.Read())
     {
         switch (reader.Name)
         {
             case "CHANNEL":
                 MMatchChannel channel = new MMatchChannel();
                 channel.szName = reader.GetAttribute("name");
                 if (!Int32.TryParse(reader.GetAttribute("levelmin"), out channel.nMinLevel))
                     channel.nMinLevel = 0;
                 channel.nMaxUsers = Int32.Parse(reader.GetAttribute("maxplayers"));
                 channel.uidChannel = Convert.ToUInt64(mChannels.Count);
                 channel.nChannelType = MMatchChannelType.General;
                 switch (reader.GetAttribute("rule"))
                 {
                     case "elite":
                         channel.nChannelRule = MMatchChannelRule.Elite;
                         break;
                 }
                 mChannels.Add(channel);
                 break;
         }
     }
 }
Example #7
0
        public List<ProgramElement> Parse(string filename)
        {
            var programElements = new List<ProgramElement>();

            XmlTextReader reader = new XmlTextReader(filename);

            while (reader.Read())
            {
                string text = String.Empty;

                if (reader.NodeType == XmlNodeType.Text)
                {
                    text = reader.Value;
                }
                else if (reader.NodeType == XmlNodeType.Element)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        text += reader.Value + " ";
                    }
                }

                if (!String.IsNullOrWhiteSpace(text))
                {
                    var cleanedText = text.TrimStart(' ', '\n', '\r', '\t');
                    cleanedText = cleanedText.TrimEnd(' ', '\n', '\r', '\t');
                    var linenum = reader.LineNumber;
                    var snippet = SrcMLParsingUtils.RetrieveSource(cleanedText);
                    var pe = new TextFileElement(filename, snippet, cleanedText);
                    programElements.Add(pe);
                }
            }

            return programElements;
        }
 public CategoriesInfoRepository()
 {
     XmlReader reader = new XmlTextReader(path);
     List<CategoryInfo> infoFromXml = (List<CategoryInfo>)writers.Deserialize(reader);
     reader.Close();
     this.categoriesInfolList = infoFromXml;
 }
Example #9
0
        private string ReadTokensFromXML()
        {
            string tokens = String.Empty;

            try
            {
                XmlTextReader tokensXmlReader = new XmlTextReader(String.Format(@"{0}\{1}",
                                                                  System.IO.Directory.GetCurrentDirectory(),
                                                                  xmlName));
                while (tokensXmlReader.Read())
                {
                    if (tokensXmlReader.NodeType == XmlNodeType.Element && tokensXmlReader.Name == "token")
                    {
                        tokens += String.Format("Token \"{0}\"\n \tLine: {1}\n \tPosition: {2}\n \tValue: {3}\n\n",
                                                tokensXmlReader.GetAttribute("type"),
                                                Convert.ToString(Convert.ToInt32(tokensXmlReader.GetAttribute("line")) + 1),
                                                tokensXmlReader.GetAttribute("position"),
                                                tokensXmlReader.GetAttribute("value"));
                    }
                }

                tokensXmlReader.Close();
                return tokens;
            }
            catch
            {
                return "";
            }
        }
        protected void visualizeDo_Click(object sender, EventArgs e)
        {

            // get xslt file
            string xslt = "";
            if (xsltSelection.Value.Contains("<xsl:stylesheet"))
            {
                xslt = xsltSelection.Value;
            }
            else
            {
                System.IO.StreamReader xsltFile =
                System.IO.File.OpenText(
                    IOHelper.MapPath(SystemDirectories.Umbraco + "/xslt/templates/clean.xslt")
                );

                xslt = xsltFile.ReadToEnd();
                xsltFile.Close();

                // parse xslt
                xslt = xslt.Replace("<!-- start writing XSLT -->", xsltSelection.Value);

                // prepare support for XSLT extensions
                xslt = macro.AddXsltExtensionsToHeader(xslt);

            }

            Dictionary<string, object> parameters = new Dictionary<string, object>(1);
            parameters.Add("currentPage", library.GetXmlNodeById(contentPicker.Value));


            // apply the XSLT transformation
            string xsltResult = "";
            XmlTextReader xslReader = null;
            try
            {
                xslReader = new XmlTextReader(new StringReader(xslt));
                System.Xml.Xsl.XslCompiledTransform xsl = macro.CreateXsltTransform(xslReader, false);
                xsltResult = macro.GetXsltTransformResult(new XmlDocument(), xsl, parameters);
            }
            catch (Exception ee)
            {
                xsltResult = string.Format(
                    "<div class=\"error\"><h3>Error parsing the XSLT:</h3><p>{0}</p></div>",
                    ee.ToString());
            }
            finally
            {
                xslReader.Close();
            }
            visualizeContainer.Visible = true;

            // update output
            visualizeArea.Text = !String.IsNullOrEmpty(xsltResult) ? "<div id=\"result\">" + xsltResult + "</Div>" : "<div class=\"notice\"><p>The XSLT didn't generate any output</p></div>";


            // add cookie with current page
			// zb-00004 #29956 : refactor cookies names & handling
			cookie.SetValue(contentPicker.Value);
        }
        /// <summary> Reads metadata from an open stream and saves to the provided item/package </summary>
        /// <param name="Input_Stream"> Open stream to read metadata from </param>
        /// <param name="Return_Package"> Package into which to read the metadata </param>
        /// <param name="Options"> Dictionary of any options which this metadata reader/writer may utilize </param>
        /// <param name="Error_Message">[OUTPUT] Explanation of the error, if an error occurs during reading </param>
        /// <returns>TRUE if successful, otherwise FALSE </returns>
        public bool Read_Metadata(Stream Input_Stream, SobekCM_Item Return_Package, Dictionary<string, object> Options, out string Error_Message)
        {
            // Set default error outpt message
            Error_Message = String.Empty;

            // Create a XML reader and read the metadata
            XmlTextReader nodeReader = null;
            bool returnValue = true;
            try
            {
                // create the node reader
                nodeReader = new XmlTextReader(Input_Stream);
                MODS_METS_dmdSec_ReaderWriter.Read_MODS_Info(nodeReader, Return_Package.Bib_Info, Return_Package);
            }
            catch (Exception ee)
            {
                Error_Message = "Error reading MODS from stream: " + ee.Message;
                returnValue = false;
            }
            finally
            {
                if (nodeReader != null)
                    nodeReader.Close();
            }

            return returnValue;
        }
		List<SyntaxMode> ScanDirectory(string directory)
		{
			string[] files = Directory.GetFiles(directory);
			List<SyntaxMode> modes = new List<SyntaxMode>();
			foreach (string file in files) {
				if (Path.GetExtension(file).Equals(".XSHD", StringComparison.OrdinalIgnoreCase)) {
					XmlTextReader reader = new XmlTextReader(file);
					while (reader.Read()) {
						if (reader.NodeType == XmlNodeType.Element) {
							switch (reader.Name) {
								case "SyntaxDefinition":
									string name       = reader.GetAttribute("name");
									string extensions = reader.GetAttribute("extensions");
									modes.Add(new SyntaxMode(Path.GetFileName(file),
									                         name,
									                         extensions));
									goto bailout;
								default:
									throw new HighlightingDefinitionInvalidException("Unknown root node in syntax highlighting file :" + reader.Name);
							}
						}
					}
				bailout:
					reader.Close();
					
				}
			}
			return modes;
		}
Example #13
0
        private void FromXml(String xmlStream)
        {
            try
            {
                StringReader stringReader = new StringReader(xmlStream);
                XmlTextReader reader = new XmlTextReader(stringReader);
                while (reader.EOF == false)
                {
                    reader.ReadStartElement("ValidationContext");
                    String generateSummaryResults = reader.ReadElementString("GenerateSummaryResults");
                    if (generateSummaryResults == "true")
                    {
                        _generateSummaryResults = true;
                    }
                    String generateDetailedResults = reader.ReadElementString("GenerateDetailedResults");
                    if (generateDetailedResults == "true")
                    {
                        _generateDetailedResults = true;
                    }
                    // ...
                    // EVS Specific Context properties
                    // ...
                    reader.ReadElementString("EvsSpecificContext");

                    reader.ReadEndElement();
                }
                reader.Close();
            }
            catch (Exception e)
            {
                String message = String.Format("Failed to FromXml() DVTK DICOM EVS Validation Context XML stream: \"{0}\". Error: \"{1}\"", xmlStream, e.Message);
                throw new Exception(message, e);
            }
        }
Example #14
0
 /// <summary>
 /// Creates an instance of the given type from the specified Internet resource.
 /// </summary>
 /// <param name="htmlUrl">The requested URL, such as "http://Myserver/Mypath/Myfile.asp".</param>
 /// <param name="xsltUrl">The URL that specifies the XSLT stylesheet to load.</param>
 /// <param name="xsltArgs">An <see cref="XsltArgumentList"/> containing the namespace-qualified arguments used as input to the transform.</param>
 /// <param name="type">The requested type.</param>
 /// <param name="xmlPath">A file path where the temporary XML before transformation will be saved. Mostly used for debugging purposes.</param>
 /// <returns>An newly created instance.</returns>
 public object CreateInstance(string htmlUrl, string xsltUrl, XsltArgumentList xsltArgs, Type type,
                              string xmlPath)
 {
     StringWriter sw = new StringWriter();
     XmlTextWriter writer = new XmlTextWriter(sw);
     if (xsltUrl == null)
     {
         LoadHtmlAsXml(htmlUrl, writer);
     }
     else
     {
         if (xmlPath == null)
         {
             LoadHtmlAsXml(htmlUrl, xsltUrl, xsltArgs, writer);
         }
         else
         {
             LoadHtmlAsXml(htmlUrl, xsltUrl, xsltArgs, writer, xmlPath);
         }
     }
     writer.Flush();
     StringReader sr = new StringReader(sw.ToString());
     XmlTextReader reader = new XmlTextReader(sr);
     XmlSerializer serializer = new XmlSerializer(type);
     object o;
     try
     {
         o = serializer.Deserialize(reader);
     }
     catch (InvalidOperationException ex)
     {
         throw new Exception(ex + ", --- xml:" + sw);
     }
     return o;
 }
Example #15
0
 public Parser(XmlTextReader reader)
 {
     this.reader = reader;
     this.reader.WhitespaceHandling = WhitespaceHandling.None;
        // 'None' only prevents whitespace  being returned as a node
        // Now assuming that there is no embedded whitespace that isn't significant.
 }
        protected override void ProcessRecord()
        {
            const BindingFlags commonBindings = BindingFlags.NonPublic | BindingFlags.Instance;
            const BindingFlags methodBindings = BindingFlags.InvokeMethod | commonBindings;
            var type = typeof(PSObject).Assembly.GetType("System.Management.Automation.Deserializer");
            var ctor = type.GetConstructor(commonBindings, null, new[] { typeof(XmlReader) }, null);

            using (var sr = new StringReader(InputObject))
            {
                using (var xr = new XmlTextReader(sr))
                {
                    var deserializer = ctor.Invoke(new object[] { xr });
                    while (!(bool)type.InvokeMember("Done", methodBindings, null, deserializer, new object[] { }))
                    {
                        try
                        {
                            WriteObject(type.InvokeMember("Deserialize", methodBindings, null, deserializer, new object[] { }));
                        }
                        catch (Exception ex)
                        {
                            WriteWarning("Could not deserialize string. Exception: " + ex.Message);
                        }
                    }
                }
            }
        }
		public CAGCategory( CAGCategory parent, XmlTextReader xml )
		{
			m_Parent = parent;

			if ( xml.MoveToAttribute( "title" ) )
				m_Title = xml.Value;
			else
				m_Title = "empty";

			if ( m_Title == "Docked" )
				m_Title = "Docked 2";

			if ( xml.IsEmptyElement )
			{
				m_Nodes = new CAGNode[0];
			}
			else
			{
				ArrayList nodes = new ArrayList();

				/*while ( xml.Read() && xml.NodeType != XmlNodeType.EndElement )
				{
					if ( xml.NodeType == XmlNodeType.Element && xml.Name == "object" )
						nodes.Add( new CAGObject( this, xml ) );
					else if ( xml.NodeType == XmlNodeType.Element && xml.Name == "category" )
						nodes.Add( new CAGCategory( this, xml ) );
					else
						xml.Skip();
				}*/

				m_Nodes = (CAGNode[])nodes.ToArray( typeof( CAGNode ) );
			}
		}
Example #18
0
        public void GetObject(string strResource, string strID, string strType)
        {
            string requestArguments = "?Resource=" + strResource + "&ID=" + strID + "&Type=" + strType;
            string searchService = RetsUrl + "/GetObject.svc/GetObject" + requestArguments;

            httpWebRequest = (HttpWebRequest)WebRequest.Create(searchService);
            httpWebRequest.CookieContainer = cookieJar; //GRAB THE COOKIE
            httpWebRequest.Credentials = requestCredentials; //PASS CREDENTIALS

            try
            {
                using (HttpWebResponse httpResponse = httpWebRequest.GetResponse() as HttpWebResponse)
                {

                    // READ THE RESPONSE STREAM USING XMLTEXTREADER
                    if (httpResponse.StatusCode == HttpStatusCode.OK)
                    {
                        Stream stream = httpResponse.GetResponseStream(); // READ THE RESPONSE STREAM USING STREAMREADER
                        StreamReader reader = new StreamReader(stream);
                        XmlTextReader reader2 = new XmlTextReader(stream);
                        XmlDocument doc = new XmlDocument();
                        doc.Load(reader);
                        doc.Save(HttpContext.Current.Server.MapPath(strResource + "Obj.xml"));
                        Console.WriteLine("Received photo -> resource:" + strResource + ", type: " + strType);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
        public void OnStartUp()
        {
            SetRootPathProject();

            XmlTextReader configReader = new XmlTextReader(new MemoryStream(NHibernate.Test.Properties.Resources.Configuration));
            DirectoryInfo dir = new DirectoryInfo(this.rootPathProject + ".Hbm");
            Console.WriteLine(dir);

            builder = new NhConfigurationBuilder(configReader, dir);

            builder.SetProperty("connection.connection_string", GetConnectionString());

            try
            {
                builder.BuildSessionFactory();
                sessionFactory = builder.SessionFactory;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                throw;
            }
            
            sessionProvider = new SessionManager(sessionFactory);
            currentPagedDAO = new EnterprisePagedDAO(sessionProvider);
            currentRootPagedDAO = new EnterpriseRootDAO<object>(sessionProvider);
            currentSession = sessionFactory.OpenSession();
        }
 static XmlSchema GetEprSchema()
 {
     using (XmlTextReader reader = new XmlTextReader(new StringReader(Schema)) { DtdProcessing = DtdProcessing.Prohibit })
     {
         return XmlSchema.Read(reader, null);
     }
 }
		public TemplateInfo[] ReadTemplates()
		{
			ArrayList result = new ArrayList();
			if(Directory.Exists(_templateFolder))
			{
				foreach(string dir in Directory.GetDirectories(_templateFolder))
				{
					string templateFile = Path.Combine(dir, "template.xml");
					if( File.Exists(templateFile ) )
					{
						XmlTextReader reader = new XmlTextReader(templateFile);
						try
						{
							reader.Read();
							reader.ReadStartElement("Template");
							reader.ReadStartElement("TemplateData");
							reader.ReadStartElement("Name");
							string name = reader.ReadString();
							DirectoryInfo directoryInfo = new DirectoryInfo(dir);
							TemplateInfo templateInfo = new TemplateInfo(name, directoryInfo.Name );
							result.Add(templateInfo);
						}
						finally
						{
							reader.Close();
						}
					}
				}
			}
			return (TemplateInfo[])result.ToArray(typeof(TemplateInfo));
		}
        /// <summary>
        /// Load matrix from XML file
        /// </summary>
        /// <param name="fileName">file name</param>
        /// <returns>Loaded matrix</returns>
        public Matrix Load(string fileName)
        {
            XmlTextReader textReader = new XmlTextReader(fileName);
            Matrix matrix = new Matrix();
            string fromWord = null;
            string toWord;
            float statisticValue;

            while (textReader.Read())
            {
                if (textReader.NodeType == XmlNodeType.Element)
                {
                    if (textReader.Name == "fromWord")
                    {
                        fromWord = textReader.GetAttribute("name");
                    }
                    else if (textReader.Name == "toWord")
                    {
                        if (fromWord != null)
                        {
                            toWord = textReader.GetAttribute("name");
                            float.TryParse(textReader.GetAttribute("statisticValue"), out statisticValue);
                            matrix.SetStatistics(fromWord, toWord, statisticValue);
                        }
                    }
                }
            }

            textReader.Close();

            return matrix;
        }
Example #23
0
        private static void LoadItems()
        {
            XmlReader reader = new XmlTextReader("zitem.xml");
            while (reader.Read())
            {
                switch (reader.Name)
                {
                    case "ITEM":
                        Item item = new Item();
                        item.nItemID = Int32.Parse(reader.GetAttribute("id"));
                        item.nLevel = (byte)Int32.Parse(reader.GetAttribute("res_level"));
                        item.nWeight = Int32.Parse(reader.GetAttribute("weight"));
                        item.nMaxWT = reader.GetAttribute("maxwt") == null ? 0 : Int32.Parse(reader.GetAttribute("maxwt"));
                        item.nPrice = reader.GetAttribute("bt_price") == null ? 0 : Int32.Parse(reader.GetAttribute("bt_price"));
                        mItems.Add(item);
                        break;
                }
            }

            reader = new XmlTextReader("shop.xml");
            while (reader.Read())
            {
                switch (reader.Name)
                {
                    case "SELL":
                        mShop.Add(UInt32.Parse(reader.GetAttribute("itemid")));
                        break;
                }
            }
        }
 /// <summary> Reads the inner data from the Template XML format </summary>
 /// <param name="xmlReader"> Current template xml configuration reader </param>
 /// <remarks> This reads the possible values for the combo box from a <i>options</i> subelement and the default value from a <i>value</i> subelement </remarks>
 protected override void Inner_Read_Data( XmlTextReader xmlReader )
 {
     default_values.Clear();
     while ( xmlReader.Read() )
     {
         if (( xmlReader.NodeType == XmlNodeType.Element ) && (( xmlReader.Name.ToLower() == "value" ) || ( xmlReader.Name.ToLower() == "options" )))
         {
             if ( xmlReader.Name.ToLower() == "value" )
             {
                 xmlReader.Read();
                 default_values.Add(xmlReader.Value.Trim());
             }
             else
             {
                 xmlReader.Read();
                 string options = xmlReader.Value.Trim();
                 items.Clear();
                 if ( options.Length > 0 )
                 {
                     string[] options_parsed = options.Split(",".ToCharArray());
                     foreach (string thisOption in options_parsed.Where(thisOption => !items.Contains(thisOption.Trim())))
                     {
                         items.Add( thisOption.Trim() );
                     }
                 }
             }
         }
     }
 }
Example #25
0
        /// <summary>
        /// Constructs the Arcs using Xml
        /// </summary>
        /// <param name="vsXml">Xml data</param>
        public Arcs(string vsXml)
        {
            XmlTextReader reader = new XmlTextReader(new StringReader(vsXml));
            reader.Read();

            ArcType = (EnumArcType)Enum.Parse(typeof(EnumArcType), reader.GetAttribute("arctype"));

            moArcList = new List<Arc>();

            while (reader.Read())
            {
                switch (reader.Name)
                {
                    case "Arcs" :
                        if (reader.NodeType != XmlNodeType.EndElement)
                        {
                            if (moInnerArcs == null)
                            {
                                moInnerArcs = new List<Arcs>();
                            }
                            moInnerArcs.Add(new Arcs(reader.ReadOuterXml()));
                        }
                        break;
                    case "Arc" :
                        moArcList.Add(new Arc(reader.ReadOuterXml()));
                        break;
                }
            }
        }
        public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            XmlTextReader reader = new XmlTextReader(context.ResponseStream);
            SendMessageResponse response = new SendMessageResponse();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        switch (reader.LocalName)
                        {
                            case MNSConstants.XML_ELEMENT_MESSAGE_ID:
                                response.MessageId = reader.ReadElementContentAsString();
                                break;
                            case MNSConstants.XML_ELEMENT_MESSAGE_BODY_MD5:
                                response.MessageBodyMD5 = reader.ReadElementContentAsString();
                                break;
                        }
                        break;
                }
            }
            reader.Close();
            return response;
        }
        public override int Run(string[] args)
        {
            string schemaFileName = args[0];
            string outschemaFileName = args[1];

            XmlTextReader xr = new XmlTextReader(schemaFileName);
            SchemaInfo schemaInfo = SchemaManager.ReadAndValidateSchema(xr, Path.GetDirectoryName(schemaFileName));
            schemaInfo.Includes.Clear();
            schemaInfo.Classes.Sort(CompareNames);
            schemaInfo.Relations.Sort(CompareNames);

            XmlSerializer ser = new XmlSerializer(typeof(SchemaInfo));
            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
            ns.Add("", SchemaInfo.XmlNamespace);

            using (FileStream fs = File.Create(outschemaFileName))
            {
                try
                {
                    ser.Serialize(fs, schemaInfo, ns);
                }
                finally
                {
                    fs.Flush();
                    fs.Close();
                }
            }

            return 0;
        }
Example #28
0
        private void FlashMovieFlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
        {
            try
            {
                XmlTextReader reader = new XmlTextReader(new StringReader(e.request));
                reader.WhitespaceHandling = WhitespaceHandling.Significant;
                reader.MoveToContent();

                if (reader.Name == "invoke" && reader.GetAttribute("name") == "trace")
                {
                    reader.Read();
                    if (reader.Name == "arguments")
                    {
                        reader.Read();
                        if (reader.Name == "string")
                        {
                            reader.Read();
                            TraceManager.Add(reader.Value, 1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorManager.ShowError(ex);
            }
        }
        internal void ReadXml(XmlTextReader reader)
        {
            while (reader.Read())
            {
                // End of credit_card element, get out of here
                if (reader.Name == "credit_card" && reader.NodeType == XmlNodeType.EndElement)
                    break;

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                        case "year":
                            this.ExpirationYear = reader.ReadElementContentAsInt();
                            break;

                        case "month":
                            this.ExpirationMonth = reader.ReadElementContentAsInt();
                            break;

                        case "last_four":
                            this.LastFour = reader.ReadElementContentAsString();
                            break;

                        case "type":
                            this.CreditCardType = reader.ReadElementContentAsString();
                            break;
                    }
                }
            }
        }
Example #30
0
 public static List<PackageInfo> LoadUpdateList(string fileName)
 {
     XmlSerializer serializer = new XmlSerializer(typeof(List<PackageInfo>));
     XmlTextReader xmlTextReader = new XmlTextReader(fileName);
     _updateList = (List<PackageInfo>)serializer.Deserialize(xmlTextReader);
     return _updateList;
 }