public static void loadXML()
        {
            if (pointers.Count <= 0)  {
                reader = new XmlTextReader("RocketLeague.CT");

                while (reader.ReadToFollowing("CheatEntry"))
                {
                    reader.ReadToFollowing("Description");
                    string name = reader.ReadElementContentAsString().Trim('"');

                    reader.ReadToFollowing("Address");
                    string adress = reader.ReadElementContentAsString();
                    string offsets = "";

                    reader.ReadToFollowing("Offsets");
                    reader.Read();
                    while (reader.Read() && reader.NodeType != XmlNodeType.EndElement)
                    {
                        offsets = "+" + reader.ReadElementContentAsString() + offsets;
                    }

                    pointers.Add(name, adress + offsets);
                }
                reader.Close();
            }
        }
Example #2
0
        public void readXml()
        {
            using (XmlTextReader reader = new XmlTextReader("dump.xml"))
            {
                reader.ReadToFollowing("range");
                while (reader.EOF == false)
                {

                    reader.MoveToFirstAttribute();
                    rangeNameList.Add(reader.Value);
                    reader.MoveToNextAttribute();
                    string temp = (reader.Value);
                    rangeNameList.Add(temp);
                    rangeStartList.Add(Int32.Parse(reader.Value, System.Globalization.NumberStyles.HexNumber));
                    reader.MoveToNextAttribute();
                    temp = (reader.Value);
                    rangeNameList.Add(temp);
                    int temp1 = (Int32.Parse(reader.Value, System.Globalization.NumberStyles.HexNumber));
                    int temp2 = rangeStartList[rangeStartList.Count-1];
                    rangeLengthList.Add(temp1-temp2);

                    reader.ReadToFollowing("range");
                }

            }
        }
Example #3
0
		protected override void LoadRules (Category c)
		{			
			// load xml file from smokey resources
			using (Stream ruleInfo = SmokeyRunner.Smokey.GetManifestResourceStream (c.Id + ".xml")) {
				using (XmlTextReader reader = new XmlTextReader (ruleInfo)) {
					reader.WhitespaceHandling = WhitespaceHandling.None;
			
					// we need to know all rule ids, names and descriptions
					while (reader.Read ()) {
						reader.ReadToFollowing ("Violation");	
						string ruleId = reader.GetAttribute ("checkID"); // id
						do {
							if (reader.EOF)
								break;
					
							reader.ReadToFollowing ("Translation");
						} while (reader.GetAttribute ("lang") != "en");
				
						if (reader.EOF)
								break;
				
						string ruleName = reader.GetAttribute ("typeName"); // name
						reader.ReadToFollowing ("Description");
						string ruleDescription = reader.ReadElementContentAsString (); // description
				
						SmokeyRule rule = new SmokeyRule (ruleId, ruleName, ruleDescription);
						SmokeyRuleCache.Add (rule);
						base.AddRule (c, rule);
					}
				}
			}
		}
Example #4
0
 private void loadState(XmlFile stateXml)
 {
     XmlTextReader textReader = new XmlTextReader(stateXml.fileName);
     textReader.ReadToFollowing("lightsAndSoundOn");
     lightsAndSoundOn = textReader.ReadElementContentAsBoolean();
     textReader.ReadToFollowing("safeToDisableChoreo");
     safeToDisableChoreo = textReader.ReadElementContentAsBoolean();
     textReader.Close();
 }
Example #5
0
 private void parseXML(string filename)
 {
     using (XmlTextReader reader = new XmlTextReader(filename))
     {
         reader.ReadToFollowing("title");
         Title = reader.ReadElementContentAsString();
         reader.ReadToFollowing("path");
         Path = reader.ReadElementContentAsString();
         reader.ReadToFollowing("description");
         Description = reader.ReadElementContentAsString();
         reader.ReadToFollowing("img_path");
         ImagePath = reader.ReadElementContentAsString();
     }
 }
        public OpenXML_Zefania_XML_Bible_Markup_Language(string fileLocation, bible_data.BookManipulator manipulator)
        {
            _fileLocation = fileLocation;
            _reader = new XmlTextReader(_fileLocation);
            _bible = manipulator;

            // Create an XmlReader for <format>Zefania XML Bible Markup Language</format>
            using (_reader)
            {
                _reader.ReadToFollowing("title");
                String title = _reader.ReadElementContentAsString();
                _bible.SetVersion(title);

                String book;
                int verseNumber;
                int chapterNumber;
                string verseString;

                while (_reader.ReadToFollowing("BIBLEBOOK")) // read each book name
                {
                    _reader.MoveToAttribute(1);
                    book = _reader.Value;
                    _reader.ReadToFollowing("CHAPTER");
                    while (_reader.Name == "CHAPTER") // read each chapter
                    {
                        _reader.MoveToFirstAttribute();
                        chapterNumber = Convert.ToInt32(_reader.Value);

                        _reader.ReadToFollowing("VERS");
                        while (_reader.Name == "VERS") // read each verse
                        {
                            _reader.MoveToFirstAttribute();
                            verseNumber = Convert.ToInt32(_reader.Value);
                            _reader.Read();
                            verseString = _reader.Value;

                            sendToDataTree(book, verseNumber, chapterNumber, verseString);

                            _reader.Read();
                            _reader.Read();
                            _reader.Read();
                        }//end verse while

                        _reader.Read();
                        _reader.Read();
                    } //end chapter while
                } // end book while
            } //end using statement
        }
Example #7
0
        // Replicates the functionality of the internal Page.EnableLegacyRendering property
        public static bool EnableLegacyRendering()
        {
            // 2007-10-02: The following commented out code will NOT work in Medium Trust environments
            //Configuration cfg = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
            //XhtmlConformanceSection xhtmlSection = (XhtmlConformanceSection) cfg.GetSection("system.web/xhtmlConformance");

            //return xhtmlSection.Mode == XhtmlConformanceMode.Legacy;

            // 2007-10-02: The following work around, provided by Michael Tobisch, works in
            //              Medium Trust by directly reading the Web.config file as XML.
            bool result;

            try
            {
                string webConfigFile = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "web.config");
                XmlTextReader webConfigReader = new XmlTextReader(new StreamReader(webConfigFile));
                result = ((webConfigReader.ReadToFollowing("xhtmlConformance")) && (webConfigReader.GetAttribute("mode") == "Legacy"));
                webConfigReader.Close();
            }
            catch
            {
                result = false;
            }
            return result;
        }
Example #8
0
 private string getFormatName(string fileLocation)
 {
     XmlTextReader XMLreader;
     XMLreader = new XmlTextReader(fileLocation);
     XMLreader.ReadToFollowing("format");
     return XMLreader.ReadElementContentAsString();
 }
Example #9
0
 // be careful - have to read nodes in the order they are written!
 private void loadPreferences(XmlFile prefsXml)
 {
     XmlTextReader textReader = new XmlTextReader(prefsXml.fileName);
     textReader.ReadToFollowing("minimizeToSystemTray");
     minimizePref.Checked = textReader.ReadElementContentAsBoolean();
     textReader.Close();
 }
Example #10
0
 public static Molecule ParseCML(FileStream file)
 {
     Dictionary<int, BondingAtom> atoms = new Dictionary<int, BondingAtom>();
     XmlTextReader reader = new XmlTextReader(file);
     reader.ReadToFollowing("molecule");
     reader.ReadToDescendant("atomArray");
     reader.ReadToDescendant("atom");
     do
     {
         atoms.Add(int.Parse(reader.GetAttribute("id").Substring(1)) - 1, new BondingAtom(Elements.FromSymbol(reader.GetAttribute("elementType"))));
     } while (reader.ReadToNextSibling("atom"));
     reader.ReadToNextSibling("bondArray");
     reader.ReadToDescendant("bond");
     do
     {
         string[] atomRefs = reader.GetAttribute("atomRefs2").Split(' ');
         int order = 0;
         switch (reader.GetAttribute("order"))
         {
             case "S":
                 order = 1;
                 break;
             case "D":
                 order = 2;
                 break;
             case "T":
                 order = 3;
                 break;
         }
         atoms[int.Parse(atomRefs[0].Substring(1)) - 1].Bond(atoms[int.Parse(atomRefs[1].Substring(1)) - 1], order);
     } while (reader.ReadToNextSibling("bond"));
     return new Molecule(new List<BondingAtom>(atoms.Values));
 }
Example #11
0
        private void Settings_Load(object sender, EventArgs e)
        {
            XmlTextReader xreader = new XmlTextReader("settings.xml");

            xreader.ReadToFollowing("twitch_server");
            Server = xreader.GetAttribute("value");
            xreader.ReadToFollowing("twitch_name");
            Username = xreader.GetAttribute("value");
            xreader.ReadToFollowing("twitch_auth");
            AuthCode = xreader.GetAttribute("value");

            xreader.Close();

            tbServer.Text = Server;
            tbUsername.Text = Username;
            tbAuth.Text = AuthCode;
        }
Example #12
0
 //This function is to pull a specific item from the settings.xml
 public string GetSetting(string setting, string xmlFile)
 {
     string foundString ="";
     XmlTextReader xml = new XmlTextReader(xmlFile);
     xml.ReadToFollowing(setting);
     foundString = xml.ReadElementContentAsString(setting, "");
     return foundString;
 }
Example #13
0
        public static HaarCascade FromXml(TextReader stringReader)
        {
            XmlTextReader xmlReader = new XmlTextReader(stringReader);

            xmlReader.ReadToFollowing("size");
            string size = xmlReader.ReadElementContentAsString();

            xmlReader.ReadToFollowing("stages");
            XmlSerializer serializer = new XmlSerializer(typeof(HaarCascadeSerializationObject));
            var stages = (HaarCascadeSerializationObject)serializer.Deserialize(xmlReader);

            string[] s = size.Trim().Split(' ');
            int baseWidth = int.Parse(s[0], CultureInfo.InvariantCulture);
            int baseHeight = int.Parse(s[1], CultureInfo.InvariantCulture);

            return new HaarCascade(baseWidth, baseHeight, stages.Stages);
        }
Example #14
0
        public ParsedFeed(string userID)
        {
            String URLString = String.Format("https://www.amazon.com/rss/people/{0}/reviews/ref=cm_rss_member_rev_manlink", userID);
            XmlTextReader reader = new XmlTextReader(URLString);
            this.FeedReviews = new List<ParsedReview> { };
            reader.ReadToFollowing("link");
            this.PublishDate = reader.ReadElementContentAsString();
            while (reader.ReadToFollowing("item"))
            {
                ParsedReview review = new ParsedReview();
                reader.ReadToFollowing("title");
                review.Title = reader.ReadElementContentAsString().Trim();
                reader.ReadToFollowing("guid");
                string tempguid = reader.ReadElementContentAsString();
                review.ASIN = tempguid.Substring(tempguid.Length - 10);
                reader.ReadToFollowing("link");
                review.Link = reader.ReadElementContentAsString();
                reader.ReadToFollowing("pubDate");
                review.ReviewDate = DateTime.Parse(reader.ReadElementContentAsString());
                reader.ReadToFollowing("description");
                review.RawText = reader.ReadElementContentAsString();
                this.FeedReviews.Add(review);

            }
        }
Example #15
0
        public string ConstructBody()
        {
            using (var reader = new XmlTextReader(new StringReader(page)))
            {
                reader.DtdProcessing = DtdProcessing.Ignore;
                reader.ReadToFollowing("body");

                return reader.ReadOuterXml();
            }
        }
 private void readXmlContent()
 {
     XmlTextReader reader = new XmlTextReader(".\\configurationFiles\\FilePaths.xml");
     String osName = externalCode.OSVersionInfo.Name.Split(new char[]{' '})[0].ToLower();
     while (reader.ReadToFollowing("os"))
     {
         reader.MoveToFirstAttribute();
         if (reader.Value.Equals(osName))
         {
             reader.ReadToFollowing("fileName");
             this.fileName = reader.ReadElementContentAsString();
             reader.ReadToFollowing("environmentVariable");
             this.environmentVariable = reader.ReadElementContentAsString();
             reader.ReadToFollowing("path");
             this.path = reader.ReadElementContentAsString();
             break;
         }
     }
 }
Example #17
0
 private void Form3_Load(object sender, EventArgs e)
 {
     XmlTextReader reader = new XmlTextReader(flrt.DName);
     reader.ReadToFollowing("Name");
     textBox4.Text = (string)reader.ReadElementContentAs(typeof(string), null);
     reader.ReadToNextSibling("Mask");
     textBox4.Text += (string)reader.ReadElementContentAs(typeof(string), null);
     textBox2.Text = Func.FName;
     Funcs.ReadXml(flrt.DName);
     dataGridView1.DataSource = Funcs;
     dataGridView1.DataMember = "function";
 }
Example #18
0
 private static List<string> GetAllFunctionIds(Stream stream)
 {
     var reader = new XmlTextReader(stream);
     var list = new List<string>();
     while (reader.ReadToFollowing("Function"))
     {
         string attribute = reader.GetAttribute("Id");
         if (attribute != null)
             list.Add(attribute);
     }
     stream.Position = 0L;
     return list;
 }
Example #19
0
        public static Project ReadFrom(string filePath)
        {
            var project = new Project();

            using (var stream = new StreamReader(filePath, Encoding.UTF8))
            using (var xml = new XmlTextReader(stream))
            {
                xml.ReadToFollowing("Project");

                if (xml.ReadToFollowing("Id"))
                {
                    project.Id = new Guid(xml.ReadElementContentAsString());
                }

                if (xml.ReadToFollowing("Name"))
                {
                    project.Name = xml.ReadElementContentAsString();
                }

                if (xml.ReadToFollowing("Code"))
                {
                    project.Code = xml.ReadElementContentAsString();
                }

                if (xml.ReadToFollowing("Items"))
                {
                    while (xml.ReadToFollowing("Item"))
                    {
                        xml.ReadToFollowing("Name");
                        var name = xml.ReadElementContentAsString();
                        xml.ReadToFollowing("Type");
                        var et = xml.ReadElementContentAsString();
                        project.Items.Add(new ProjectItem { Name = name, Type = et });
                    }
                }
            }
            return project;
        }
Example #20
0
        public static VProject ReadFrom(XmlTextReader xml, IProjectConfiguration config)
        {
            var project = new VProject();

            if (xml.ReadToFollowing("Code"))
            {
                var code = xml.ReadElementContentAsString();
                project.ProjectDescriptor = config.GetDescriptor(code);
            }

            if (xml.ReadToFollowing("ProjectItems"))
            {
                while (xml.ReadToFollowing("ProjectItem"))
                {
                    xml.ReadToFollowing("Name");
                    var name = xml.ReadElementContentAsString();
                    xml.ReadToFollowing("Code");
                    var c = xml.ReadElementContentAsString();
                    project.Items.Add(new VProjectItem(config.GetItemDescriptor(c), name));
                }
            }
            return project;
        }
Example #21
0
        public static string CheckOperation(string xml)
        {
            using (XmlTextReader r = new XmlTextReader(new StringReader(xml)))
            {
                if (!r.ReadToFollowing("operation"))
                    return "xml";

                if (r.GetAttribute("status") == "success")
                    return null;

                string s = r.GetAttribute("error");
                return !string.IsNullOrEmpty(s) ? s : r.ReadString();
            }
        }
Example #22
0
        public string GetBody()
        {
            using (var reader = new XmlTextReader(new StringReader(Body)))
            {
                reader.DtdProcessing = DtdProcessing.Ignore;
                reader.WhitespaceHandling = WhitespaceHandling.None;

                reader.ReadToFollowing("body");
                var builder = new StringBuilder();
                var sub = reader.ReadSubtree();
                while (sub.Read())
                {
                    builder.Append(sub.ReadInnerXml());
                }
                return builder.ToString();
            }
        }
Example #23
0
        public MaterialReader()
        {
            try
            {
                XmlTextReader reader = new XmlTextReader(Application.StartupPath + "\\config\\materials.xml");
                reader.MoveToContent();

                while (reader.ReadToFollowing("material"))
                {
                    ProcessItem(reader.ReadSubtree());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public List<Article> MakeList(params string[] searchCriteria)
        {
            List<Article> articles = new List<Article>();

            foreach (string s in searchCriteria)
            {
                int start = 0;
                do
                {
                    string url = string.Format(BaseUrl, s, Variables.URL, NoOfResultsPerRequest, start);

                    using (XmlTextReader reader = new XmlTextReader(new StringReader(Tools.GetHTML(url))))
                    {
                        while (reader.Read())
                        {
                            if (reader.Name.Equals("Error"))
                            {
                                reader.ReadToFollowing("Code");
                                if (string.Compare(reader.ReadString(), "2002", true) == 0)
                                    Tools.MessageBox("Query limit for Bing Exceeded. Please try again later");

                                return articles;
                            }

                            if (reader.Name.Equals("web:Total"))
                            {
                                if (int.Parse(reader.ReadString()) > TotalResults)
                                    start += NoOfResultsPerRequest;
                            }

                            if (reader.Name.Equals("web:Url"))
                            {
                                string title = Tools.GetTitleFromURL(reader.ReadString());

                                if (!string.IsNullOrEmpty(title))
                                    articles.Add(new Article(title));
                            }
                        }
                    }
                } while (articles.Count < TotalResults);
            }

            return articles;
        }
Example #25
0
        public static string VersionSynchro()
        {
            Var.fenetrePrincipale.pictureBox6.Visible = false;
            string VersionSynchro;
            try
            {
                XmlTextReader fichierInfoServer = new XmlTextReader(Var.fenetrePrincipale.textBox18.Text + @"\@FSF\version.xml");
                fichierInfoServer.ReadToFollowing("VERSION");
                VersionSynchro = fichierInfoServer.ReadString();
                fichierInfoServer.Close();

            }
            catch
            {
                return "null";
            }
            VersionSynchroCompare(VersionSynchro);
            return VersionSynchro;
        }
Example #26
0
 static OrderWizard()
 {
     string conditionsDataPath =
         HttpContext.Current.Server.MapPath(PathToJoesPubSeatingConditions);
     XmlTextReader reader = new XmlTextReader(conditionsDataPath);
     if (!reader.ReadToFollowing("pubSeatingConditions"))
         throw new XmlException("Can't find <pubSeatingConditions> node.");
     if (!reader.ReadToDescendant("section"))
         throw new XmlException("Can't find any <section> nodes.");
     syosSeatingConditions = new Dictionary<int, string>();
     do
     {
         if (!reader.MoveToAttribute("id"))
             throw new XmlException("Can't find \"id\" attribute for <section>.");
         int id = Int32.Parse(reader.Value.Trim());
         reader.MoveToElement();
         string conditions = reader.ReadElementContentAsString();
         syosSeatingConditions.Add(id, conditions);
     }
     while (reader.ReadToNextSibling("section"));
 }
        /// <summary>
        /// Determinates which version of the xml if this current file, and read color and opacity function from it. 
        /// </summary>
        /// <param name="fileName">Name of the preset</param>
        /// <returns>Information about the preset, which includes series of color and opacity function</returns>
        public PresetInformation ReadXmlFile(String fileName)
        {
            try
            {
                _reader = new XmlTextReader(Path.Combine(Directory.GetCurrentDirectory(), @"presety\", fileName));
                _reader.ReadToFollowing("IndependentColor");
                Boolean isIndependent = _reader.ReadElementContentAsBoolean();

                if (isIndependent)
                {
                    return ReadOpacityFunction(fileName, ReadColorFunction());
                }
                return ReadOpacityAndColorFunction();
            }
            catch (Exception e)
            {
                logger.ErrorException("Preset file reading exception: "+e.Message, e);
                logger.Warn(Path.Combine(Directory.GetCurrentDirectory(), @"presety\", fileName));
                return new PresetInformation();
            }
        }
Example #28
0
		public static DCompilerConfiguration LoadFromString(string xmlCode)
		{
			var cmp = new DCompilerConfiguration();

			var x = new XmlTextReader(new StringReader(xmlCode));

			if (x.ReadToFollowing("Compiler"))
			{
				if (x.MoveToAttribute("Name"))
				{
					cmp.Vendor = x.ReadContentAsString();
					x.MoveToElement();
				}

				cmp.ReadFrom(x);
			}

			x.Close();

			FitFileExtensions(cmp);

			return cmp;
		}
Example #29
0
        public static VCase ReadFrom(string filePath, IProjectConfiguration config)
        {
            var vCase = new VCase();

            using (var stream = new StreamReader(filePath, Encoding.UTF8))
            using (var xml = new XmlTextReader(stream))
            {
                xml.ReadToFollowing("Case");

                if (xml.ReadToFollowing("Name"))
                {
                    vCase.Name = xml.ReadElementContentAsString();
                }

                if (xml.ReadToFollowing("CaseItems"))
                {
                    while (xml.ReadToFollowing("CaseItem"))
                    {
                        VCaseItem item = null;
                        xml.ReadToFollowing("Id");
                        var id = xml.ReadElementContentAsString();

                        xml.ReadToFollowing("DisplayName");
                        var displayName = xml.ReadElementContentAsString();

                        xml.ReadToFollowing("RelativePath");
                        var relativePath = xml.ReadElementContentAsString();

                        xml.ReadToFollowing("Type");
                        var type = xml.ReadElementContentAsString();
                        if (type == ProjectItem)
                        {
                            item = ProjectHandler.ReadFrom(xml, config);
                        }

                        Debug.Assert(item != null);
                        item.Id = new Guid(id);
                        item.DisplayName = displayName;
                        item.RelativePath = relativePath;
                        vCase.Items.Add(item);
                    }
                }
            }
            return vCase;
        }
Example #30
0
        ///<summary>
        ///getObservation method for retrieving a METAR observation based on parsed ICAO code. No return value, sets this.Metar directly
        ///</summary>
        public void getObservation()
        {
            try {
                string itemContent = "";
                //Create URL to fetch XML with Observation METAR from Geonames, ICAO code and username is parsed
                String URLString = "http://api.geonames.org/weatherIcao?ICAO=" + this.ICAO + "&username=mercantec";
                XmlTextReader reader = new XmlTextReader(URLString);

                //Read through the XML
                while (reader.Read()) {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "observation") { //Found an element named observation
                        reader.ReadToFollowing("observation"); //Read until next observation child element is found
                        itemContent = reader.ReadInnerXml(); //Read the inner xml (content) of the element to the itemContent string variable
                    } else if (reader.Name == "status") { //Found an element named status
                        itemContent = reader.GetAttribute(0); //Status text is defined in xml as the first property of the status element
                    }
                }
                this.Metar = itemContent; //Set the object Metar property to the resulting itemContent from the XML parser
            }
            catch (Exception e) {
                throw new Exception(e.Message);
            }
        }