Beispiel #1
0
    /**
     * Loads the descriptor of the current ZIP adventure loaded
     *
     * @return The descriptor data of the game
     */
    public static DescriptorData loadDescriptorData(InputStreamCreator isCreator, List <Incidence> incidences)
    {
        DescriptorData descriptorData = null;

        if (Loader.adventureData != null)
        {
            descriptorData = Loader.adventureData;
        }
        else
        {
            try
            {
                // Set the adventure handler
                DescriptorHandler descriptorParser = new DescriptorHandler(isCreator);

                //factory.setValidating(false);
                //SAXParser saxParser = factory.newSAXParser();

                // Read and close the inputstrea
                string descriptorIS = isCreator.buildInputStream("descriptor.xml");
                //saxParser.parse(descriptorIS, descriptorParser);
                //descriptorIS.close();
                descriptorParser.Parse(descriptorIS);

                // Store the adventure data
                descriptorData = descriptorParser.getGameDescriptor();
            }
            catch (Exception e) { Debug.LogError(e); }

            //catch (ParserConfigurationException e)
            //{
            //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.SAX"), e));
            //}
            //catch (SAXException e)
            //{
            //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.SAX"), e));
            //}
            //catch (IOException e)
            //{
            //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.IO"), e));
            //}
            //catch (IllegalArgumentException e)
            //{
            //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.NoDescriptor"), e));
            //}
        }
        return(descriptorData);
    }
Beispiel #2
0
    /**
     * Loads the descriptor of the current ZIP adventure loaded
     *
     * @return The descriptor data of the game
     */
    public static DescriptorData loadDescriptorData(InputStreamCreator isCreator, List<Incidence> incidences)
    {
        DescriptorData descriptorData = null;

        if (Loader.adventureData != null)
        {
            descriptorData = Loader.adventureData;
        }
        else {

            try
            {
                // Set the adventure handler
                DescriptorHandler descriptorParser = new DescriptorHandler(isCreator);

                //factory.setValidating(false);
                //SAXParser saxParser = factory.newSAXParser();

                // Read and close the inputstrea
                string descriptorIS = isCreator.buildInputStream("descriptor.xml");
                //saxParser.parse(descriptorIS, descriptorParser);
                //descriptorIS.close();
                descriptorParser.Parse(descriptorIS);

                // Store the adventure data
                descriptorData = descriptorParser.getGameDescriptor();

            }
            catch (Exception e) { Debug.LogError(e); }

            //catch (ParserConfigurationException e)
            //{
            //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.SAX"), e));
            //}
            //catch (SAXException e)
            //{
            //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.SAX"), e));
            //}
            //catch (IOException e)
            //{
            //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.IO"), e));
            //}
            //catch (IllegalArgumentException e)
            //{
            //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.NoDescriptor"), e));
            //}
        }
        return descriptorData;
    }