Example #1
0
 private void  parseTableFile(System.String filename)
 {
     try
     {
         //UPGRADE_TODO: Method 'javax.xml.parsers.SAXParser.getXMLReader' was converted to 'SupportClass.XmlSAXDocumentManager' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
         XmlSAXDocumentManager parser = XmlSAXDocumentManager.CloneInstance(XmlSAXDocumentManager.NewInstance());
         //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Reader' and 'System.IO.StreamReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
         //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
         System.IO.StreamReader r = new System.IO.StreamReader(filename, System.Text.Encoding.Default);
         parser.setContentHandler(this);
         parser.parse(new XmlSourceSupport(r));
     }
     //UPGRADE_ISSUE: Class 'javax.xml.parsers.ParserConfigurationException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxxmlparsersParserConfigurationException'"
     catch (javax.xml.parsers.ParserConfigurationException err)
     {
         System.Console.Out.WriteLine("Error while parsing XML in table.xml");
         SupportClass.WriteStackTrace(err, Console.Error);
     }
     //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
     catch (System.Xml.XmlException err)
     {
         System.Console.Out.WriteLine("Error while parsing XML in table.xml");
         SupportClass.WriteStackTrace(err, Console.Error);
     }
     catch (System.IO.IOException err)
     {
         System.Console.Out.WriteLine("Error while reading file table.xml");
         SupportClass.WriteStackTrace(err, Console.Error);
     }
 }
Example #2
0
 public MatchesParser(System.String[] commentaries)
 {
     dateDriven = false;
     vMatches   = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
     for (int i = 0; i < commentaries.Length; i++)
     {
         try
         {
             //UPGRADE_TODO: Method 'javax.xml.parsers.SAXParser.getXMLReader' was converted to 'SupportClass.XmlSAXDocumentManager' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
             XmlSAXDocumentManager parser = XmlSAXDocumentManager.CloneInstance(XmlSAXDocumentManager.NewInstance());
             //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Reader' and 'System.IO.StreamReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
             //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
             System.IO.StreamReader r = new System.IO.StreamReader(commentaries[i], System.Text.Encoding.Default);
             parser.setContentHandler(this);
             parser.parse(new XmlSourceSupport(r));
         }
         //UPGRADE_ISSUE: Class 'javax.xml.parsers.ParserConfigurationException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxxmlparsersParserConfigurationException'"
         catch (javax.xml.parsers.ParserConfigurationException err)
         {
             System.Console.Out.WriteLine("Error while parsing XML in " + commentaries[i] + " file");
             SupportClass.WriteStackTrace(err, Console.Error);
         }
         //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
         catch (System.Xml.XmlException err)
         {
             System.Console.Out.WriteLine("Error while parsing XML in " + commentaries[i] + " file");
             SupportClass.WriteStackTrace(err, Console.Error);
         }
         catch (System.IO.IOException err)
         {
             System.Console.Out.WriteLine("Error while reading " + commentaries[i] + ".xml file");
             SupportClass.WriteStackTrace(err, Console.Error);
         }
     }
 }
Example #3
0
        //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Reader' and 'System.IO.StreamReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
        public static Dictionary unmarshal(System.IO.StreamReader reader)
        {
            //LoggingTool //logger = new LoggingTool(typeof(Dictionary));
            DictionaryHandler     handler = new DictionaryHandler();
            XmlSAXDocumentManager parser  = null;

            try
            {
                parser = XmlSAXDocumentManager.NewInstance();
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                //logger.debug("Using " + parser);
            }
            catch (System.Exception e)
            {
                //logger.error("Could not instantiate any JAXP parser!");
                //logger.debug(e);
            }

            try
            {
                parser.setFeature("http://xml.org/sax/features/validation", false);
                //logger.debug("Deactivated validation");
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            catch (System.Xml.XmlException e)
            {
                //logger.warn("Cannot deactivate validation.");
                //logger.debug(e);
            }
            parser.setContentHandler(handler);
            Dictionary dict = null;

            try
            {
                parser.parse(new XmlSourceSupport(reader));
                dict = handler.Dictionary;
            }
            catch (System.IO.IOException e)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                //logger.error("IOException: " + e.ToString());
                //logger.debug(e);
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            catch (System.Xml.XmlException saxe)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Class.getName' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                //logger.error("SAXException: " + saxe.GetType().FullName);
                //logger.debug(saxe);
            }
            return(dict);
        }
Example #4
0
        //[STAThread]
        //public static void  Main(string[] args)
        //{
        //    //UPGRADE_ISSUE: Constructor 'java.text.SimpleDateFormat.SimpleDateFormat' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javatextSimpleDateFormat'"
        //    //UPGRADE_TODO: The equivalent in .NET for method 'java.util.Calendar.getTime' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
        //    System.Console.Out.WriteLine(Version.Name + " Language.dat Importer Version " + Version.getVersion() + " - " + Version.Codename + " (" + SupportClass.FormatDateTime(new SimpleDateFormat("dd MMM yyyy"), SupportClass.CalendarManager.manager.GetDateTime(Version.LastBuild)) + ")\r\n" + Version.Features + "\r\n" + Version.Author);
        //    try
        //    {
        //        convertFromESMS(new System.IO.FileInfo(args[0]), new System.IO.FileInfo(args[1]));
        //    }
        //    catch (System.IO.IOException err)
        //    {
        //        //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
        //        System.Console.Out.WriteLine(err.ToString());
        //    }
        //}

        //private static void  convertFromESMS(System.IO.FileInfo source, System.IO.FileInfo destination)
        //{
        //    //UPGRADE_TODO: The differences in the expected value  of parameters for constructor 'java.io.BufferedReader.BufferedReader'  may cause compilation errors.  "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'"
        //    //UPGRADE_WARNING: At least one expression was used more than once in the target code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1181'"
        //    //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
        //    System.IO.StreamReader read = new System.IO.StreamReader(new System.IO.StreamReader(source.FullName, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(source.FullName, System.Text.Encoding.Default).CurrentEncoding);
        //    //UPGRADE_TODO: Constructor 'java.io.OutputStreamWriter.OutputStreamWriter' was converted to 'System.IO.StreamWriter.StreamWriter' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioOutputStreamWriterOutputStreamWriter_javaioOutputStream_javalangString'"
        //    //UPGRADE_TODO: Constructor 'java.io.FileOutputStream.FileOutputStream' was converted to 'System.IO.FileStream.FileStream' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioFileOutputStreamFileOutputStream_javaioFile'"
        //    System.IO.StreamWriter w = new System.IO.StreamWriter(new System.IO.FileStream(destination.FullName, System.IO.FileMode.Create), System.Text.Encoding.GetEncoding("iso-8859-1"));

        //    w.Write("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
        //    w.Write("<Language>");
        //    Pattern p = Pattern.compile("\\[([A-Z,_]*)\\]\\ \\{\\\\n\\ *(...|.*)(.*)\\}");
        //    string text;
        //    while (read.Peek() != -1 && (text = read.ReadLine()) != null)
        //    {
        //        //String text = read.readLine();
        //        Matcher m = p.matcher(text);
        //        while (!m.matches())
        //        {
        //            if (!(read.Peek() != -1))
        //            {
        //                w.Write("</Language>");
        //                w.Flush();
        //                w.Close();
        //                return ;
        //            }
        //            text = read.ReadLine();
        //            m = p.matcher(text);
        //        }
        //        w.Write("<Comment type=\"" + m.group(1) + "\" followup=\"");
        //        w.Write(Boolean.toString(m.group(2).equals("...")) + "\">");
        //        if (!m.group(2).equals("..."))
        //            w.write(m.group(2));
        //        w.write(m.group(3));
        //        w.Write("</Comment>");
        //        w.Write("\r\n");
        //        w.Flush();
        //    }
        //    w.Write("</Language>");
        //    w.Flush();
        //    w.Close();
        //}

        /// <summary>Creates a new instance of Comment </summary>
        private Comment(string fileName)
        {
            throw new NotImplementedException("Error en ESMS.Comment.Comment(string fileName) - HZ: este metodo no se si sirve de mucho, ver donde se utiliza. Cambiar el XML por el DAL.");

            /* Usually this function is called
             *          from inside the ESMS so the RandomGenerator has been already
             *          instantiated but, just in case, if the RandomGenerator has still to be
             *          instantiated we will raise an instance with randomized seed */
            //      try
            //      {
            _rnd = CSEsMS.ESMS.ESMS.Random;
            //      }
            //      catch(NullPointerException err)
            //      {
            //          ESMS.setRandomEngine();
            //          _rnd = ESMS.getRandom();
            //      }

            _table    = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
            _tagStack = new System.Collections.ArrayList();

            try
            {
                //UPGRADE_TODO: Method 'javax.xml.parsers.SAXParser.getXMLReader' was converted to 'SupportClass.XmlSAXDocumentManager' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                XmlSAXDocumentManager parser = XmlSAXDocumentManager.CloneInstance(XmlSAXDocumentManager.NewInstance());
                //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Reader' and 'System.IO.StreamReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
                //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                System.IO.StreamReader r = new System.IO.StreamReader(fileName, System.Text.Encoding.Default);
                parser.setContentHandler(this);
                parser.parse(new XmlSourceSupport(r));
            }
            //UPGRADE_ISSUE: Class 'javax.xml.parsers.ParserConfigurationException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxxmlparsersParserConfigurationException'"
            //catch (javax.xml.parsers.ParserConfigurationException err)
            catch (Exception err)
            {
                System.Console.Out.WriteLine("Error while parsing XML in language.xml");
                SupportClass.WriteStackTrace(err, Console.Error);
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            //catch (System.Xml.XmlException err)
            //{
            //    System.Console.Out.WriteLine("Error while parsing XML in language.xml");
            //    SupportClass.WriteStackTrace(err, Console.Error);
            //}
            //catch (System.IO.IOException err)
            //{
            //    System.Console.Out.WriteLine("Error while reading file language.xml");
            //    SupportClass.WriteStackTrace(err, Console.Error);
            //}
        }
Example #5
0
        /// <summary>Creates a new instance of League </summary>
        public League(System.String fileName, System.String fixtures)
        {
            vTeams   = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable());
            tagStack = new System.Collections.ArrayList();

            try
            {
                //UPGRADE_TODO: Method 'javax.xml.parsers.SAXParser.getXMLReader' was converted to 'SupportClass.XmlSAXDocumentManager' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                XmlSAXDocumentManager parser = XmlSAXDocumentManager.CloneInstance(XmlSAXDocumentManager.NewInstance());
                //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Reader' and 'System.IO.StreamReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
                //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                System.IO.StreamReader r = new System.IO.StreamReader(fileName, System.Text.Encoding.Default);
                parser.setContentHandler(this);
                parser.parse(new XmlSourceSupport(r));
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            catch (System.Xml.XmlException err)
            {
                System.Console.Out.WriteLine("Error while parsing XML in " + fileName + ".xml file");
                SupportClass.WriteStackTrace(err, Console.Error);
            }
            catch (System.IO.IOException err)
            {
                System.Console.Out.WriteLine("Error while reading " + fileName + ".xml file");
                SupportClass.WriteStackTrace(err, Console.Error);
            }

            //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'"
            for (System.Collections.IEnumerator e = vTeams.Values.GetEnumerator(); e.MoveNext();)
            {
                //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'"
                ((Team)e.Current).Clean();
            }

            FixturesParser parser2 = new FixturesParser(fixtures);

            Engine.Match[] m = parser2.Matches;
            for (int i = 0; i < m.Length; i++)
            {
                Team home = (Team)vTeams[m[i].HomeTeam];
                Team away = (Team)vTeams[m[i].AwayTeam];

                if (m[i].hasBeenPlayed())
                {
                    home.addMatch(m[i].HomeScore, m[i].AwayScore);
                    away.addMatch(m[i].AwayScore, m[i].HomeScore);
                }
            }
        }
Example #6
0
 public MatchesParser(System.String dirbase)
 {
     vMatches = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
     initDate();
     System.IO.FileInfo f = new System.IO.FileInfo(dirbase);
     //UPGRADE_TODO: The equivalent in .NET for method 'java.io.File.list' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
     System.String[] xmlfiles = System.IO.Directory.GetFileSystemEntries(f.FullName);
     for (int i = 0; i < xmlfiles.Length; i++)
     {
         if (xmlfiles[i].ToLower().EndsWith(".xml"))
         {
             try
             {
                 //UPGRADE_TODO: Method 'javax.xml.parsers.SAXParser.getXMLReader' was converted to 'SupportClass.XmlSAXDocumentManager' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                 XmlSAXDocumentManager parser = XmlSAXDocumentManager.CloneInstance(XmlSAXDocumentManager.NewInstance());
                 //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Reader' and 'System.IO.StreamReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
                 //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                 System.IO.StreamReader r = new System.IO.StreamReader(xmlfiles[i], System.Text.Encoding.Default);
                 parser.setContentHandler(this);
                 parser.parse(new XmlSourceSupport(r));
             }
             //UPGRADE_ISSUE: Class 'javax.xml.parsers.ParserConfigurationException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxxmlparsersParserConfigurationException'"
             catch (javax.xml.parsers.ParserConfigurationException err)
             {
                 System.Console.Out.WriteLine("Error while parsing XML in " + xmlfiles[i] + " file");
                 SupportClass.WriteStackTrace(err, Console.Error);
             }
             //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
             catch (System.Xml.XmlException err)
             {
                 System.Console.Out.WriteLine("Error while parsing XML in " + xmlfiles[i] + " file");
                 SupportClass.WriteStackTrace(err, Console.Error);
             }
             catch (System.IO.IOException err)
             {
                 System.Console.Out.WriteLine("Error while reading " + xmlfiles[i] + ".xml file");
                 SupportClass.WriteStackTrace(err, Console.Error);
             }
         }
     }
 }
Example #7
0
        /// <summary>Creates a new instance of Fixtures </summary>
        public Fixtures(System.String tableFile, System.String output)
        {
            vTeams = new System.Collections.ArrayList();
            try
            {
                //UPGRADE_TODO: Method 'javax.xml.parsers.SAXParser.getXMLReader' was converted to 'SupportClass.XmlSAXDocumentManager' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                XmlSAXDocumentManager parser = XmlSAXDocumentManager.CloneInstance(XmlSAXDocumentManager.NewInstance());
                //UPGRADE_ISSUE: Class hierarchy differences between 'java.io.Reader' and 'System.IO.StreamReader' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1186'"
                //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                System.IO.StreamReader r = new System.IO.StreamReader(tableFile, System.Text.Encoding.Default);
                parser.setContentHandler(this);
                parser.parse(new XmlSourceSupport(r));
            }
            //UPGRADE_ISSUE: Class 'javax.xml.parsers.ParserConfigurationException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaxxmlparsersParserConfigurationException'"
            catch (javax.xml.parsers.ParserConfigurationException err)
            {
                System.Console.Out.WriteLine("Error while parsing XML in " + tableFile + " file");
                SupportClass.WriteStackTrace(err, Console.Error);
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            catch (System.Xml.XmlException err)
            {
                System.Console.Out.WriteLine("Error while parsing XML in " + tableFile + " file");
                SupportClass.WriteStackTrace(err, Console.Error);
            }
            catch (System.IO.IOException err)
            {
                System.Console.Out.WriteLine("Error while reading " + tableFile + " file");
                SupportClass.WriteStackTrace(err, Console.Error);
            }

            IGenerator gen = new LeagueGenerator();

            gen.Generate(Teams, cname, wname);
            if (seed)
            {
                PunkBuster.GenerateSeeds(gen);
            }
            gen.WriteCompetition(output);
        }
Example #8
0
        /// <summary> Triggers the XML parsing of the data file and returns the read Isotopes.
        /// It turns of XML validation before parsing.
        ///
        /// </summary>
        /// <returns> a Vector of Isotope's. Returns an empty vector is some reading error
        /// occured.
        /// </returns>
        public virtual List <PeriodicTableElement> readElements()
        {
            List <PeriodicTableElement> elements = new List <PeriodicTableElement>();

            try
            {
                parser.setFeature("http://xml.org/sax/features/validation", false);
                //logger.info("Deactivated validation");
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            catch (System.Xml.XmlException exception)
            {
                //logger.warn("Cannot deactivate validation: ", exception.Message);
                //logger.debug(exception);
            }
            ElementPTHandler handler = new ElementPTHandler();

            parser.setContentHandler(handler);
            try
            {
                parser.parse(new XmlSourceSupport(input));
                elements = new List <PeriodicTableElement>((PeriodicTableElement[])handler.Elements.ToArray(typeof(PeriodicTableElement)));
            }
            catch (System.IO.IOException exception)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                //logger.error("IOException: ", exception.Message);
                //logger.debug(exception);
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            catch (System.Xml.XmlException saxe)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Class.getName' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                //logger.error("SAXException: ", saxe.GetType().FullName);
                //logger.error(saxe.Message);
                //logger.debug(saxe);
            }
            return(elements);
        }
Example #9
0
        /// <summary> Triggers the XML parsing of the data file and returns the read Isotopes.
        /// It turns of XML validation before parsing.
        ///
        /// </summary>
        /// <returns> a Vector of Isotope's. Returns an empty vector is some reading error
        /// occured.
        /// </returns>
        public virtual System.Collections.ArrayList readIsotopes()
        {
            System.Collections.ArrayList isotopes = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            try
            {
                parser.setFeature("http://xml.org/sax/features/validation", false);
                //logger.info("Deactivated validation");
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            catch (System.Xml.XmlException exception)
            {
                //logger.warn("Cannot deactivate validation: ", exception.Message);
                //logger.debug(exception);
            }
            IsotopeHandler handler = new IsotopeHandler(builder);

            parser.setContentHandler(handler);
            try
            {
                parser.parse(new XmlSourceSupport(input));
                isotopes = handler.Isotopes;
            }
            catch (System.IO.IOException exception)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                //logger.error("IOException: ", exception.Message);
                //logger.debug(exception);
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            catch (System.Xml.XmlException saxe)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Class.getName' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                //logger.error("SAXException: ", saxe.GetType().FullName);
                //logger.error(saxe.Message);
                //logger.debug(saxe);
            }
            return(isotopes);
        }
Example #10
0
		/// <summary>
		/// Returns a clone instance of 'XmlSAXDocumentManager'.
		/// </summary>
		/// <returns>A clone 'XmlSAXDocumentManager' instance.</returns>
		public static XmlSAXDocumentManager CloneInstance(XmlSAXDocumentManager instance)
		{
			XmlSAXDocumentManager temp = new XmlSAXDocumentManager();
			temp.NamespaceAllowed = instance.NamespaceAllowed;
			temp.isValidating = instance.isValidating;
			XmlSaxContentHandler contentHandler = instance.getContentHandler();
			if (contentHandler != null)
				temp.setContentHandler(contentHandler);
			XmlSaxErrorHandler errorHandler = instance.getErrorHandler();
			if (errorHandler != null)
				temp.setErrorHandler(errorHandler);
			temp.setFeature("http://xml.org/sax/features/namespaces", instance.getFeature("http://xml.org/sax/features/namespaces"));
			temp.setFeature("http://xml.org/sax/features/namespace-prefixes", instance.getFeature("http://xml.org/sax/features/namespace-prefixes"));
			temp.setFeature("http://xml.org/sax/features/validation", instance.getFeature("http://xml.org/sax/features/validation"));
			temp.setProperty("http://xml.org/sax/properties/lexical-handler", instance.getProperty("http://xml.org/sax/properties/lexical-handler"));
			temp.parserFileName = instance.parserFileName;
			return temp;
		}
Example #11
0
        // private functions

        private IChemFile readChemFile(IChemFile file)
        {
            //logger.debug("Started parsing from input...");
            ChemFileCDO cdo = new ChemFileCDO(file);

            try
            {
                parser.setFeature("http://xml.org/sax/features/validation", false);
                //logger.info("Deactivated validation");
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            catch (System.Xml.XmlException e)
            {
                //logger.warn("Cannot deactivate validation.");
                return(cdo);
            }
            parser.setContentHandler(new CMLHandler((IChemicalDocumentObject)cdo));
            parser.setEntityResolver(new CMLResolver());
            //UPGRADE_TODO: Method 'org.xml.sax.XMLReader.setErrorHandler' was converted to 'XmlSAXDocumentManager.SetErrorHandler' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_orgxmlsaxXMLReadersetErrorHandler_orgxmlsaxErrorHandler'"
            parser.setErrorHandler(new CMLErrorHandler());
            try
            {
                if (input == null)
                {
                    //logger.debug("Parsing from URL: ", url);
                    parser.parse(url);
                }
                else
                {
                    //logger.debug("Parsing from Reader");
                    input.BaseStream.Seek(0, SeekOrigin.Begin);
                    parser.parse(new XmlSourceSupport(input));
                }
            }
            catch (System.IO.IOException e)
            {
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
                System.String error = "Error while reading file: " + e.Message;
                //logger.error(error);
                //logger.debug(e);
                throw new CDKException(error, e);
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXParseException' was converted to 'System.xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            catch (System.Xml.XmlException saxe)
            {
                //UPGRADE_TODO: Class 'org.xml.sax.SAXParseException' was converted to 'System.xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                System.Xml.XmlException spe   = (System.Xml.XmlException)saxe;
                System.String           error = "Found well-formedness error in line " + spe.LineNumber;
                //logger.error(error);
                //logger.debug(saxe);
                throw new CDKException(error, saxe);
            }
            //UPGRADE_TODO: Class 'org.xml.sax.SAXException' was converted to 'System.Xml.XmlException' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
            //catch (System.Xml.XmlException saxe)
            //{
            //    System.String error = "Error while parsing XML: " + saxe.Message;
            //    //logger.error(error);
            //    //logger.debug(saxe);
            //    throw new CDKException(error, saxe);
            //}
            return(cdo);
        }