Beispiel #1
0
 public virtual void startElement(string str, string str2, string tag, SaxAttributesSupport attributes)
 {
     _tagStack.Add(tag);
     if (tag.Equals("Fixtures"))
     {
         _competition = attributes.GetValue("competition");
         _weekName    = attributes.GetValue("weekName");
         if (attributes.GetValue("type").Equals("League"))
         {
             _type = Fixtures._LEAGUE;
         }
     }
     else if (tag.Equals("Week"))
     {
         _currentWeek = new Week(attributes.GetValue("id"));
         //UPGRADE_NOTE: Exceptions thrown by the equivalent in .NET of method 'java.lang.Boolean.valueOf' may be different. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1099'"
         _currentWeek.Played = System.Boolean.Parse(attributes.GetValue("played"));
         _weeks.Add(_currentWeek);
     }
     else if (tag.Equals("Match"))
     {
         Match m;
         if (_currentWeek.hasBeenPlayed())
         {
             m = new Match(attributes.GetValue("id"), attributes.GetValue("homeTeam"), System.Int32.Parse(attributes.GetValue("homeScore")), attributes.GetValue("awayTeam"), System.Int32.Parse(attributes.GetValue("awayScore")));
         }
         else
         {
             m = new Match(attributes.GetValue("id"), attributes.GetValue("homeTeam"), attributes.GetValue("awayTeam"));
         }
         _currentWeek.addMatch(m);
     }
 }
Beispiel #2
0
        private IIsotope createIsotopeOfElement(System.String currentElement, SaxAttributesSupport atts)
        {
            IIsotope isotope = builder.newIsotope(currentElement);

            for (int i = 0; i < atts.GetLength(); i++)
            {
                try
                {
                    if ("id".Equals(atts.GetFullName(i)))
                    {
                        isotope.ID = atts.GetValue(i);
                    }
                    else if ("isotopeNumber".Equals(atts.GetFullName(i)))
                    {
                        isotope.MassNumber = System.Int32.Parse(atts.GetValue(i));
                    }
                    else if ("elementType".Equals(atts.GetFullName(i)))
                    {
                        isotope.Symbol = atts.GetValue(i);
                    }
                }
                catch (System.FormatException exception)
                {
                    //logger.error("Value of isotope@", atts.GetFullName(i), " is not as expected.");
                    //logger.debug(exception);
                }
            }
            return(isotope);
        }
Beispiel #3
0
        public virtual void startElement(string str, string str2, string tag, SaxAttributesSupport attributes)
        {
            _tagStack.Add(tag);

            if ((System.Object)tag == (System.Object) "Tactic")
            {
                _currentName = attributes.GetValue("name");
            }
            else if ((System.Object)tag == (System.Object) "Bonus" || (System.Object)tag == (System.Object) "Mult")
            {
                string position   = attributes.GetValue("position");
                string skill      = attributes.GetValue("skill");
                string multiplier = attributes.GetValue("multiplier");
                if ((System.Object)tag == (System.Object) "Bonus")
                {
                    string oppTactic = attributes.GetValue("oppTactic");
                    Bonus  temp      = new Bonus(oppTactic, position, skill, multiplier);
                    _vBonuses.Add(temp);
                }
                else
                {
                    Mult temp = new Mult(position, skill, multiplier);
                    _vMults.Add(temp);
                }
            }
        }
Beispiel #4
0
 public virtual void  startElement(string str, string str2, string tag, SaxAttributesSupport attributes)
 {
     _tagStack.Add(tag);
     sb = new System.Text.StringBuilder();
     if ((System.Object)tag == (System.Object) "Comment")
     {
         _currentType = attributes.GetValue("type");
     }
 }
Beispiel #5
0
 public virtual void  startElement(string str, string str2, string tag, SaxAttributesSupport attributes)
 {
     tagStack.Add(tag);
     /* Attributes must be managed here */
     if ((System.Object)tag == (System.Object) "Team")
     {
         teamName = attributes.GetValue("abbr");
     }
 }
Beispiel #6
0
 private System.String getElementSymbol(SaxAttributesSupport atts)
 {
     for (int i = 0; i < atts.GetLength(); i++)
     {
         if ("id".Equals(atts.GetFullName(i)))
         {
             return(atts.GetValue(i));
         }
     }
     return("");
 }
		public virtual void  linestyle(SaxAttributesSupport attributes)
		{
			DefineShape defineShape = (DefineShape) stack[stack.Count - 1];
			LineStyle linestyle = new LineStyle();
			if (defineShape.code == flash.swf.TagValues_Fields.stagDefineShape3)
			{
				linestyle.color = parseRGBA(getAttribute(attributes, "color"));
			}
			else
			{
				linestyle.color = parseRGB(getAttribute(attributes, "color"));
			}
			linestyle.width = parseInt(getAttribute(attributes, "width"));
			linestyles.Add(linestyle);
		}
		public virtual void  FrameLabel(SaxAttributesSupport attributes)
		{
			FrameLabel frameLabel = new FrameLabel();
			frameLabel.label = getAttribute(attributes, "label");
			frameLabel.anchor = parseBoolean(getAttribute(attributes, "anchor"));
			tagHandler.frameLabel(frameLabel);
		}
		public virtual void  ImportAssets(SaxAttributesSupport attributes)
		{
			ImportAssets importAssets = new ImportAssets(flash.swf.TagValues_Fields.stagImportAssets);
			importAssets.url = getAttribute(attributes, "url");
			importAssets.importRecords = new System.Collections.ArrayList();
			stack.Add(importAssets);
		}
Beispiel #10
0
 public virtual void  startElement(System.String str, System.String str2, System.String tag, SaxAttributesSupport attributes)
 {
     //UPGRADE_TODO: The 'System.Boolean' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
     if (!tag.Equals("Match") && matchAlreadyFound == null)
     {
         matchAlreadyFound = false;
     }
     //UPGRADE_TODO: The 'System.Boolean' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
     if (tag.Equals("Match") && matchAlreadyFound == null && attributes.GetValue("date").Equals(todayString))
     {
         /* The match file needs to be parsed */
         matchAlreadyFound = true;
         currentHomeTeam   = attributes.GetValue("home");
         currentAwayTeam   = attributes.GetValue("away");
     }
     //UPGRADE_TODO: The 'System.Boolean' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
     if (matchAlreadyFound != null && matchAlreadyFound.Equals(true))
     {
         if (tag.Equals("Score"))
         {
             currentHomeScore = System.Int32.Parse(attributes.GetValue("home"));
             currentAwayScore = System.Int32.Parse(attributes.GetValue("away"));
         }
     }
 }
		public virtual void  Export(SaxAttributesSupport attributes)
		{
			ExportAssets tag = (ExportAssets) stack[stack.Count - 1];
			int idref = parseInt(getAttribute(attributes, "idref"));
			System.String name = getAttribute(attributes, "name");
			DefineTag ref_Renamed = findCharacter(idref);
			ref_Renamed.name = name;
			tag.exports.Add(ref_Renamed);
		}
		public virtual void  SetBackgroundColor(SaxAttributesSupport attributes)
		{
			SetBackgroundColor tag = new SetBackgroundColor(parseRGB(getAttribute(attributes, "color")));
			currentHandler().BackgroundColor = tag;
		}
Beispiel #13
0
 public virtual void  startElement(System.String str, System.String str2, System.String tag, SaxAttributesSupport attributes)
 {
     //UPGRADE_TODO: The 'System.Boolean' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
     if (!tag.Equals("Match") && matchAlreadyFound == null)
     {
         matchAlreadyFound = false;
     }
     //UPGRADE_TODO: The 'System.Boolean' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
     if (tag.Equals("Match") && matchAlreadyFound == null && (!dateDriven || attributes.GetValue("date").Equals(todayString)))
     {
         /* The match file needs to be parsed */
         matchAlreadyFound = true;
         currentMatch      = new Match(attributes.GetValue("home"), attributes.GetValue("away"));
     }
     //UPGRADE_TODO: The 'System.Boolean' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
     if (matchAlreadyFound != null && matchAlreadyFound.Equals(true))
     {
         if (tag.Equals("Score"))
         {
             currentMatch.setScore(System.Int32.Parse(attributes.GetValue("home")), System.Int32.Parse(attributes.GetValue("away")));
         }
         else if (tag.Equals("TeamStats"))
         {
             currentTeam = attributes.GetValue("team");
         }
         else if (tag.Equals("PlayerStats"))
         {
             try
             {
                 if (System.Int32.Parse(attributes.GetValue("minutes")) == 0)
                 {
                     currentMatch.addPlayer(currentTeam, new UpdaterPlayer(attributes.GetValue("name")));
                 }
                 else
                 {
                     currentMatch.addPlayer(currentTeam, new UpdaterPlayer(attributes.GetValue("name"), System.Int32.Parse(attributes.GetValue("keepingAbility")), System.Int32.Parse(attributes.GetValue("tacklingAbility")), System.Int32.Parse(attributes.GetValue("passingAbility")), System.Int32.Parse(attributes.GetValue("shootingAbility")), System.Int32.Parse(attributes.GetValue("saves")), System.Int32.Parse(attributes.GetValue("keyTackling")), System.Int32.Parse(attributes.GetValue("keyPassing")), System.Int32.Parse(attributes.GetValue("assists")), System.Int32.Parse(attributes.GetValue("shots")), System.Int32.Parse(attributes.GetValue("goals")), System.Int32.Parse(attributes.GetValue("yellowCards")), System.Int32.Parse(attributes.GetValue("redCards")), attributes.GetValue("injured").ToUpper().Equals("TRUE")));
                 }
             }
             catch (System.Exception err)
             {
                 //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'"
                 throw new System.Xml.XmlException("", err);
             }
         }
     }
 }
Beispiel #14
0
 public override void startElement(System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     currentChars = "";
     dictRef      = "";
     //logger.debug("startElement: ", raw);
     //logger.debug("uri: ", uri);
     //logger.debug("local: ", local);
     //logger.debug("raw: ", raw);
     if ("elementType".Equals(local))
     {
         for (int i = 0; i < atts.GetLength(); i++)
         {
             if ("id".Equals(atts.GetFullName(i)))
             {
                 elementType = new PeriodicTableElement(atts.GetValue(i));
             }
         }
     }
     else if ("scalar".Equals(local))
     {
         for (int i = 0; i < atts.GetLength(); i++)
         {
             if ("dictRef".Equals(atts.GetFullName(i)))
             {
                 if ("cas:id".Equals(atts.GetValue(i)))
                 {
                     scalarType = LABEL_CAS;
                 }
                 else if ("cdk:name".Equals(atts.GetValue(i)))
                 {
                     scalarType = SCALAR_NAME;
                 }
                 else if ("cdk:atomicNumber".Equals(atts.GetValue(i)))
                 {
                     scalarType = SCALAR_ATOMICNUMBER;
                 }
                 else if ("cdk:name".Equals(atts.GetValue(i)))
                 {
                     scalarType = SCALAR_NAME;
                 }
                 else if ("cdk:chemicalSerie".Equals(atts.GetValue(i)))
                 {
                     scalarType = SCALAR_CHEMICALSERIE;
                 }
                 else if ("cdk:period".Equals(atts.GetValue(i)))
                 {
                     scalarType = SCALAR_PERIOD;
                 }
                 else if ("cdk:group".Equals(atts.GetValue(i)))
                 {
                     scalarType = SCALAR_GROUP;
                 }
                 else if ("cdk:phase".Equals(atts.GetValue(i)))
                 {
                     scalarType = SCALAR_PHASE;
                 }
             }
         }
     }
 }
		public virtual void  DefineSprite(SaxAttributesSupport attributes)
		{
			DefineSprite sprite = new DefineSprite();
			int id = parseInt(getAttribute(attributes, "id"));
			createCharacter(id, sprite);
			stack.Add(sprite);
			this.sprite = sprite;
		}
Beispiel #16
0
 public virtual void  startElement(System.String str, System.String str2, System.String tag, SaxAttributesSupport attributes)
 {
     tagStack.Add(tag);
     if ((System.Object)tag == (System.Object) "Keeping")
     {
         max[KEEPING] = System.Int32.Parse(attributes.GetValue("max"));
         min[KEEPING] = System.Int32.Parse(attributes.GetValue("min"));
     }
     else if ((System.Object)tag == (System.Object) "Tackling")
     {
         max[TACKLING] = System.Int32.Parse(attributes.GetValue("max"));
         min[TACKLING] = System.Int32.Parse(attributes.GetValue("min"));
     }
     else if ((System.Object)tag == (System.Object) "Passing")
     {
         max[PASSING] = System.Int32.Parse(attributes.GetValue("max"));
         min[PASSING] = System.Int32.Parse(attributes.GetValue("min"));
     }
     else if ((System.Object)tag == (System.Object) "Shooting")
     {
         max[SHOOTING] = System.Int32.Parse(attributes.GetValue("max"));
         min[SHOOTING] = System.Int32.Parse(attributes.GetValue("min"));
     }
     else if ((System.Object)tag == (System.Object) "Aggression")
     {
         max[AGGRESSION] = System.Int32.Parse(attributes.GetValue("max"));
         min[AGGRESSION] = System.Int32.Parse(attributes.GetValue("min"));
     }
     else if ((System.Object)tag == (System.Object) "Age")
     {
         max[AGE] = System.Int32.Parse(attributes.GetValue("max"));
         min[AGE] = System.Int32.Parse(attributes.GetValue("min"));
     }
     else if ((System.Object)tag == (System.Object) "TotalAllowed")
     {
         max[TOTALALLOWED] = System.Int32.Parse(attributes.GetValue("max"));
         min[TOTALALLOWED] = System.Int32.Parse(attributes.GetValue("min"));
     }
 }
Beispiel #17
0
        public override void startElement(System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
        {
            currentChars = "";
            //logger.debug("START Element: ", raw);
            //logger.debug("  uri: ", uri);
            //logger.debug("  local: ", local);
            //logger.debug("  raw: ", raw);

            if ("atomType".Equals(local))
            {
                atomType = builder.newAtomType("R");
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if ("id".Equals(atts.GetFullName(i)))
                    {
                        atomType.AtomTypeName = atts.GetValue(i);
                    }
                }
            }
            else if ("atom".Equals(local))
            {
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if ("elementType".Equals(atts.GetFullName(i)))
                    {
                        atomType.Symbol = atts.GetValue(i);
                    }
                    else if ("formalCharge".Equals(atts.GetFullName(i)))
                    {
                        try
                        {
                            atomType.setFormalCharge(System.Int32.Parse(atts.GetValue(i)));
                        }
                        catch (System.FormatException exception)
                        {
                            //logger.error("Value of <atom> @", atts.GetFullName(i), " is not an integer: ", atts.GetValue(i));
                            //logger.debug(exception);
                        }
                    }
                }
            }
            else if ("scalar".Equals(local))
            {
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if ("dictRef".Equals(atts.GetFullName(i)))
                    {
                        if ("cdk:maxBondOrder".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_MAXBONDORDER;
                        }
                        else if ("cdk:bondOrderSum".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_BONDORDERSUM;
                        }
                        else if ("cdk:hybridization".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_HYBRIDIZATION;
                        }
                        else if ("cdk:formalNeighbourCount".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_FORMALNEIGHBOURCOUNT;
                        }
                        else if ("cdk:valency".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_VALENCY;
                        }
                        else if ("cdk:formalCharge".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_FORMALCHARGE;
                        }
                        else if ("cdk:DA".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_DA;
                        }
                        else if ("cdk:sphericalMatcher".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_SPHERICALMATCHER;
                        }
                        else if ("cdk:ringSize".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_RINGSIZE;
                        }
                        else if ("cdk:ringConstant".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_CHEMICALGROUPCONSTANT;
                        }
                        else if ("cdk:aromaticAtom".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_ISAROMATIC;
                        }
                        else if ("emboss:vdwrad".Equals(atts.GetValue(i)))
                        {
                            scalarType = SCALAR_VANDERWAALSRADIUS;
                        }
                    }
                }
            }
        }
Beispiel #18
0
            public override void  startElement(System.String uri, System.String localName, System.String qName, SaxAttributesSupport attributes)
            {
                //System.err.println("startelem: " + qName + " curpathsize; " +
                //m_curPath.size());
                bool ok = false;

                if (m_startedDocument)
                {
                    // A single unit of text data will be within a single element,
                    // -- none of it will be in sub-elements and there will be no
                    // sub-elements fragmenting the data text.
                    // Right now we're entering a new element: this means that anything
                    // in m_chars will be whitespace (likely), or text left over from,
                    // say, the last field, or text that was somewhere it shouldn't have been.
                    // (ex. "<ZYX.9> shouldn't be here <PT.1> P </PT.1> </ZYX.9>"
                    m_chars.Remove(0, m_chars.Length - 0);

                    if (m_depthWithinUselessElement >= 0)
                    {
                        ++m_depthWithinUselessElement;
                    }
                    else
                    {
                        int oldCurPathSize = m_curPath.size();
                        if (tryToGrowDocLocationFromElementName(m_msgID, m_curPath, m_segmentId2nextRepIdx, m_lastDumpedPath, qName))
                        {
                            if (m_curPath.size() > oldCurPathSize)
                            {
                                // assert (m_depthWithinUselessElement == -1) // m_curPath
                                // should not have grown if we're within a useless element.
                                if (m_depthWithinUsefulElement == -1)
                                {
                                    // this new element could match one of the DatumPaths in
                                    // m_msgMask -- if that's the case, we've just entered a
                                    // useful element.
                                    // TODO: functional stylee (a la C++'s std::accumulate) ?
                                    bool curPathStartsWithAMaskElem = false;
                                    for (System.Collections.IEnumerator maskIt = m_msgMask.GetEnumerator(); !curPathStartsWithAMaskElem && maskIt.MoveNext();)
                                    {
                                        curPathStartsWithAMaskElem = m_curPath.startsWith((NuGenDatumPath)maskIt.Current);
                                    }

                                    if (curPathStartsWithAMaskElem)
                                    {
                                        m_depthWithinUsefulElement = 0;
                                    }
                                    else
                                    {
                                        // so this element we're entering is not specified by m_msgMask
                                        // to be useful -- but might it contains elements that
                                        // are?
                                        bool aMaskElemStartsWithCurPath = false;
                                        for (System.Collections.IEnumerator maskIt = m_msgMask.GetEnumerator(); !aMaskElemStartsWithCurPath && maskIt.MoveNext();)
                                        {
                                            aMaskElemStartsWithCurPath = ((NuGenDatumPath)maskIt.Current).startsWith(m_curPath);
                                        }

                                        if (!aMaskElemStartsWithCurPath)
                                        {
                                            // ... nope!  useless.
                                            m_depthWithinUselessElement = 0;
                                            m_curPath.setSize(oldCurPathSize);
                                        }                                         // else => ok, carry on, m_depthWithinUse{less,ful}Element
                                                                                  // still both -1.
                                    }
                                }
                                // else => already within a useful element, don't need to compare
                                // against m_msgMask.
                            }
                        }
                        else
                        {
                            m_depthWithinUselessElement = 0;
                        }
                    }
                    ok = true;
                }

                if (!ok)
                {
                    clear();
                    throw new StopParsingException();
                }
            }
Beispiel #19
0
        public override void startElement(System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
        {
            currentChars = "";
            if ("entry".Equals(local) && !"bibtex:entry".Equals(raw) && !inEntry)
            {
                inEntry = true;
                entry   = new Entry();
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if (atts.GetFullName(i).Equals("id"))
                    {
                        entry.ID = atts.GetValue(i);
                    }
                    else if (atts.GetFullName(i).Equals("term"))
                    {
                        entry.Label = atts.GetValue(i);
                    }
                }
            }
            if ("metadataList".Equals(local) && !inMetadataList)
            {
                inMetadataList = true;
            }

            // if we're in a metadataList then look at individual
            // metadata nodes and check for any whose content refers
            // to QSAR metadata and save that. Currently it does'nt
            // differentiate between descriptorType or descriptorClass.
            // Do we need to differentiate?
            //
            // RG: I think so and so I save a combination of the dictRef attribute
            // and the content attribute
            if ("metadata".Equals(local) && inMetadataList)
            {
                for (int i = 0; i < atts.GetLength() - 1; i += 2)
                {
                    System.String dictRefValue = "";
                    if (atts.GetFullName(i).Equals("dictRef"))
                    {
                        dictRefValue = atts.GetValue(i);
                    }
                    if (atts.GetFullName(i + 1).Equals("content"))
                    {
                        System.String content = atts.GetValue(i + 1);
                        if (content.IndexOf("qsar-descriptors-metadata:") == 0)
                        {
                            entry.setDescriptorMetadata(dictRefValue + "/" + content);
                        }
                    }
                }
            }
        }
 public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     System.String name = local;
     if (name.Equals("list"))
     {
         //logger.debug("Oke, JMOLANIMATION seems to be kicked in :)");
         cdo.startObject("Animation");
         base.startElement(xpath, uri, local, raw, atts);
     }
     else if (name.Equals("molecule"))
     {
         cdo.startObject("Frame");
         //logger.debug("New frame being parsed.");
         base.startElement(xpath, uri, local, raw, atts);
     }
     else if (name.Equals("float"))
     {
         bool isEnergy = false;
         //logger.debug("FLOAT found!");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             //logger.debug(" att: ", atts.GetFullName(i), " -> ", atts.GetValue(i));
             if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("FRAME_ENERGY"))
             {
                 isEnergy = true;
             }
         }
         if (isEnergy)
         {
             // oke, this is the frames energy!
             current = ENERGY;
         }
         else
         {
             base.startElement(xpath, uri, local, raw, atts);
         }
     }
     else
     {
         base.startElement(xpath, uri, local, raw, atts);
     }
 }
		public virtual void  JPEGTables(SaxAttributesSupport attributes)
		{
			text = new System.Text.StringBuilder();
			if (hasAttribute(attributes, "encoding"))
			{
				if (!getAttribute(attributes, "encoding").Equals("base64"))
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					fatalError(new SAXParseException("unknown encoding " + getAttribute(attributes, "encoding"), locator));
				}
			}
		}
		public virtual void  ProductInfo(SaxAttributesSupport attributes)
		{
			int product = parseInt(getAttribute(attributes, "product"));
			int edition = parseInt(getAttribute(attributes, "edition"));
			sbyte majorVersion = (sbyte) System.SByte.Parse(getAttribute(attributes, "majorVersion"));
			sbyte minorVersion = (sbyte) System.SByte.Parse(getAttribute(attributes, "majorVersion"));
			long build = System.Int64.Parse(getAttribute(attributes, "build"));
			long compileDate = System.Int64.Parse(getAttribute(attributes, "compileDate"));
			
			stack.Add(new ProductInfo(product, edition, majorVersion, minorVersion, build, compileDate));
		}
		public virtual void  styleChange(SaxAttributesSupport attributes)
		{
			StyleChangeRecord styleChange = new StyleChangeRecord();
			if (hasAttribute(attributes, "dx") || hasAttribute(attributes, "dy"))
			{
				styleChange.stateMoveTo = true;
				styleChange.moveDeltaX = parseInt(getAttribute(attributes, "dx"));
				styleChange.moveDeltaY = parseInt(getAttribute(attributes, "dy"));
			}
			if (hasAttribute(attributes, "fillStyle0"))
			{
				styleChange.stateFillStyle0 = true;
				styleChange.fillstyle0 = parseInt(getAttribute(attributes, "fillStyle0"));
			}
			if (hasAttribute(attributes, "fillStyle1"))
			{
				styleChange.stateFillStyle1 = true;
				styleChange.fillstyle1 = parseInt(getAttribute(attributes, "fillStyle1"));
			}
			if (hasAttribute(attributes, "lineStyle"))
			{
				styleChange.stateLineStyle = true;
				styleChange.linestyle = parseInt(getAttribute(attributes, "lineStyle"));
			}
			styleChange.fillstyles = new System.Collections.ArrayList();
			styleChange.linestyles = new System.Collections.ArrayList();
			fillstyles = styleChange.fillstyles;
			linestyles = styleChange.linestyles;
			stack.Add(styleChange);
		}
		public virtual void  Package(SaxAttributesSupport attributes)
		{
			text = new System.Text.StringBuilder();
			DefineSprite pkg = new DefineSprite();
			DoInitAction initAction = new DoInitAction(pkg);
			// get id for this package
			int id = parseInt(getAttribute(attributes, "id"));
			createCharacter(id, pkg);
			currentHandler().defineSprite(pkg);
			startLineNumber = locator.getLineNumber();
			stack.Add(initAction);
		}
Beispiel #25
0
 public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     if ("reaction".Equals(local))
     {
         cdo.startObject("Reaction");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att           = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("Reaction", "id", value_Renamed);
             }
         }
     }
     else if ("reactionList".Equals(local))
     {
         cdo.startObject("SetOfReactions");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att           = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("SetOfReactions", "id", value_Renamed);
             }
         }
     }
     else if ("reactant".Equals(local))
     {
         cdo.startObject("Reactant");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att           = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("Reactant", "id", value_Renamed);
             }
         }
     }
     else if ("product".Equals(local))
     {
         cdo.startObject("Product");
         for (int i = 0; i < atts.GetLength(); i++)
         {
             System.String att           = atts.GetFullName(i);
             System.String value_Renamed = atts.GetValue(i);
             if (att.Equals("id"))
             {
                 cdo.setObjectProperty("Product", "id", value_Renamed);
             }
         }
     }
     else if ("molecule".Equals(local))
     {
         // do nothing for now
         base.newMolecule();
     }
     else
     {
         base.startElement(xpath, uri, local, raw, atts);
     }
 }
		public virtual void  EnableDebugger2(SaxAttributesSupport attributes)
		{
			EnableDebugger enableDebugger2 = new EnableDebugger(flash.swf.TagValues_Fields.stagEnableDebugger2);
			enableDebugger2.password = getAttribute(attributes, "password");
			tagHandler.enableDebugger2(enableDebugger2);
		}
Beispiel #27
0
        public override void startElement(System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
        {
            xpath.push(local);
            //if (debug)
            //    logger.debug("<", raw, "> -> ", xpath);
            // Detect CML modules, like CRML and CCML
            if (local.StartsWith("reaction"))
            {
                // e.g. reactionList, reaction -> CRML module
                //logger.info("Detected CRML module");
                conv = new CMLReactionModule(conv);
                conventionStack.push(conventionStack.current());
            }
            else
            {
                // assume CML Core

                // Detect conventions
                System.String convName = "";
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if (atts.GetFullName(i).Equals("convention"))
                    {
                        convName = atts.GetValue(i);
                    }
                }
                if (convName.Length > 0)
                {
                    if (convName.Equals(conventionStack.current()))
                    {
                        //logger.debug("Same convention as parent");
                    }
                    else
                    {
                        //logger.info("New Convention: ", convName);
                        if (convName.Equals("CML"))
                        {
                            /* Don't reset the convention handler to CMLCore,
                             * becuase all handlers should extend this handler,
                             * and use it for any content other then specifically
                             * put into the specific convention */
                        }
                        else if (convName.Equals("PDB"))
                        {
                            conv = new PDBConvention(conv);
                        }
                        else if (convName.Equals("PMP"))
                        {
                            conv = new PMPConvention(conv);
                        }
                        else if (convName.Equals("MDLMol"))
                        {
                            //if (debug)
                            //    logger.debug("MDLMolConvention instantiated...");
                            conv = new MDLMolConvention(conv);
                        }
                        else if (convName.Equals("JMOL-ANIMATION"))
                        {
                            conv = new JMOLANIMATIONConvention(conv);
                        }
                        else if (userConventions.ContainsKey(convName))
                        {
                            //unknown convention. userConvention?
                            ICMLConvention newconv = (ICMLConvention)userConventions[convName];
                            newconv.inherit(conv);
                            conv = newconv;
                        }
                        else
                        {
                            //logger.warn("Detected unknown convention: ", convName);
                        }
                    }
                    conventionStack.push(convName);
                }
                else
                {
                    // no convention set/reset: take convention of parent
                    conventionStack.push(conventionStack.current());
                }
            }
            //if (debug)
            //    logger.debug("ConventionStack: ", conventionStack);
            conv.startElement(xpath, uri, local, raw, atts);
        }
Beispiel #28
0
 public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     //logger.debug("PMP element: name");
     base.startElement(xpath, uri, local, raw, atts);
 }
		public virtual void  DoAction(SaxAttributesSupport attributes)
		{
			text = new System.Text.StringBuilder();
			startLineNumber = locator.getLineNumber();
		}
            public override void  startElement(System.String uri, System.String localName, System.String qName, SaxAttributesSupport attributes)
            {
                XLRNode current = null;

                if (context.Count > 0)
                {
                    current = (XLRNode)context[context.Count - 1];
                }

                // common shortcuts...
                System.String locale = attributes.GetValue("locale");
                if (locale == null)
                {
                    locale = fileLocale;
                }
                System.String text = attributes.GetValue("text");

                XLRNode node = null;

                if ("messages".Equals(qName))
                {
                    fileLocale = attributes.GetValue("locale");
                    if (attributes.GetValue("idbase") != null)
                    {
                        base_Renamed = attributes.GetValue("idbase");
                    }
                }
                else if ("message".Equals(qName))
                {
                    System.String id = attributes.GetValue("id");

                    if (base_Renamed != null)
                    {
                        id = base_Renamed + "." + id;
                    }

                    node = (XLRMessageNode)nodedict[id];
                    if (node == null)
                    {
                        node         = new XLRMessageNode(id);
                        nodedict[id] = node;
                    }
                    if ((text != null) && (locale != null))
                    // check errors
                    {
                        XLRTargetNode targetNode = new XLRTargetNode(locale);
                        node.children.Add(targetNode);
                        XLRTextNode textNode = new XLRTextNode(text);
                        targetNode.children.Add(textNode);
                    }


                    context.Add(node);
                }
                else if ("target".Equals(qName))
                {
                    node = new XLRTargetNode(locale);
                    if (text != null)
                    {
                        node.children.Add(new XLRTextNode(text));
                    }

                    current.children.Add(node);
                    context.Add(node);
                }
                else if ("text".Equals(qName))
                {
                    System.String value_Renamed = attributes.GetValue("value");

                    node = new XLRTextNode(value_Renamed);

                    current.children.Add(node);
                    context.Add(node);
                }
                else if ("variable".Equals(qName))
                {
                    System.String name = attributes.GetValue("name");

                    node = new XLRVariableNode(name);
                    current.children.Add(node);
                    context.Add(node);
                }
                else if ("match".Equals(qName))
                {
                    node = new XLRMatchNode(attributes.GetValue("variable"), attributes.GetValue("pattern"));
                    if (text != null)
                    {
                        node.children.Add(new XLRTextNode(text));
                    }

                    current.children.Add(node);
                    context.Add(node);
                }
                else if ("select".Equals(qName))
                {
                    node = new XLRChoiceNode();
                    current.children.Add(node);
                    context.Add(node);
                }
                else
                {
                    //UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
                    throw new SAXParseException("blorp", null);                     // fixme
                }
            }
		public virtual void  FileAttributes(SaxAttributesSupport attributes)
		{
			FileAttributes tag = new FileAttributes();
			tag.hasMetadata = parseBoolean(getAttribute(attributes, "hasMetadata"));
			tag.actionScript3 = parseBoolean(getAttribute(attributes, "actionScript3"));
			tag.suppressCrossDomainCaching = parseBoolean(getAttribute(attributes, "suppressCrossDomainCaching"));
			tag.swfRelativeUrls = parseBoolean(getAttribute(attributes, "swfRelativeUrls"));
			tag.useNetwork = parseBoolean(getAttribute(attributes, "useNetwork"));
			stack.Add(tag);
		}
Beispiel #32
0
 public virtual void  startElement(System.String str, System.String str2, System.String tag, SaxAttributesSupport attributes)
 {
     if (tag.Equals("League"))
     {
         competitionName = attributes.GetValue("name");
     }
     if (tag.Equals("Team"))
     {
         vTeams.Add(attributes.GetValue("name"));
     }
 }
		public virtual void  DoInitAction(SaxAttributesSupport attributes)
		{
			text = new System.Text.StringBuilder();
			DoInitAction initAction = new DoInitAction();
			// get id of previous DefineSprite
			int idref = parseInt(getAttribute(attributes, "idref"));
			initAction.sprite = (DefineSprite) findCharacter(idref);
			startLineNumber = locator.getLineNumber();
			stack.Add(initAction);
		}
Beispiel #34
0
 public virtual void  startElement(System.String str, System.String str2, System.String tag, SaxAttributesSupport attributes)
 {
     tagStack.Add(tag);
     if ((System.Object)tag == (System.Object) "League")
     {
         name = attributes.GetValue("name");
     }
     else if ((System.Object)tag == (System.Object) "Team")
     {
         vTeams.Add(attributes.GetValue("name"));
     }
 }
		public virtual void  ExportAssets(SaxAttributesSupport attributes)
		{
			ExportAssets tag = new ExportAssets();
			stack.Add(tag);
		}
Beispiel #36
0
 public virtual void  startElement(System.String str, System.String str2, System.String tag, SaxAttributesSupport attributes)
 {
     tagStack.Add(tag);
     if ((System.Object)tag == (System.Object) "League")
     {
         name = attributes.GetValue("name");
     }
     else if ((System.Object)tag == (System.Object) "Team")
     {
         Team t = new Team(attributes.GetValue("name"), attributes.GetValue("won"), attributes.GetValue("lost"), attributes.GetValue("draw"), attributes.GetValue("goalsFor"), attributes.GetValue("goalsAgainst"), attributes.GetValue("points"));
         vTeams[t.Name] = t;
     }
 }
		public virtual void  fillstyle(SaxAttributesSupport attributes)
		{
			DefineShape defineShape = (DefineShape) stack[stack.Count - 1];
			bool hasAlpha = (defineShape.code == flash.swf.TagValues_Fields.stagDefineShape3);
			FillStyle fillstyle = new FillStyle();
			if (hasAttribute(attributes, "color"))
			{
				fillstyle.Type = FillStyle.FILL_SOLID;
				fillstyle.color = hasAlpha?parseRGBA(getAttribute(attributes, "color")):parseRGB(getAttribute(attributes, "color"));
			}
			if (hasAttribute(attributes, "gradient"))
			{
				// todo support radial gradients
				fillstyle.Type = FillStyle.FILL_LINEAR_GRADIENT;
				fillstyle.gradient = parseGradient(getAttribute(attributes, "gradient"), hasAlpha);
				fillstyle.matrix = parseMatrix(getAttribute(attributes, "matrix"));
			}
			if (hasAttribute(attributes, "idref"))
			{
				// todo support clipped bitmaps
				fillstyle.Type = FillStyle.FILL_BITS; // tiled
				int idref = parseInt(getAttribute(attributes, "idref"));
				// todo check to make sure bitmapId points to a bitmap
				fillstyle.bitmap = findCharacter(idref);
				fillstyle.matrix = parseMatrix(getAttribute(attributes, "matrix"));
			}
			
			defineShape.shapeWithStyle.fillstyles.Add(fillstyle);
		}
Beispiel #38
0
        public virtual void  startElement(string str, string str2, string tag, SaxAttributesSupport attributes)
        {
            throw new NotImplementedException("Error en Engine.Roster.startElement(string str, string str2, string tag, SaxAttributesSupport attributes). HZ: Creo que este metodo se usa para abrir los archivos XML generado por lo que no se estaria usando mas.");

            //_tagStack.Add(tag);
            //if ((System.Object) tag == (System.Object) "TeamSheet")
            //{
            //    _abbr = attributes.GetValue("name");
            //    // TODO: I need to ensure that Tactics has been loaded.
            //    this._tactic = (Tactic) Tactic.Tactics[attributes.GetValue("tactic")];
            //    /* Try to load the roster */
            //    _roster = new Roster(_abbr + ".xml");
            //}
            //else if ((System.Object) tag == (System.Object) "Player" || (System.Object) tag == (System.Object) "Substitute" || (System.Object) tag == (System.Object) "PenaltyKicker")
            //{
            //    string name = attributes.GetValue("name");
            //    string position = null;
            //    PreferredSide side = null;

            //    if ((System.Object) tag != (System.Object) "PenaltyKicker")
            //    {
            //        position = attributes.GetValue("role");
            //        if (attributes.GetValue("side") != null)
            //            side = new PreferredSide(attributes.GetValue("side"));
            //        else
            //            side = new PreferredSide("C");
            //    }

            //    Player player = null;

            //    try
            //    {
            //        player = _roster.getPlayer(name);
            //    }
            //    catch (System.Exception err)
            //    {
            //        //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.Console.Out.WriteLine(err.Message);
            //        SupportClass.WriteStackTrace(err, Console.Error);
            //        System.Environment.Exit(- 1);
            //    }
            //    if ((System.Object) tag == (System.Object) "Player")
            //    {
            //        /* Before adding the player i must check that he's not already
            //        in the team */
            //        if (player.Injury > 0 || player.Suspension > 0)
            //        {
            //            //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'"
            //            throw new System.Xml.XmlException("Error: player " + player.name + " in team " + this.Name + " is unavailable for the match");
            //        }
            //        for (int j = 0; j < _iTeam; j++)
            //        {
            //            if (_team[j].name.Equals(player.name))
            //            {
            //                //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'"
            //                throw new System.Xml.XmlException("Error: player " + player.name + " is already present in teamsheet of team " + this.Name);
            //            }
            //        }
            //        _team[_iTeam] = player;
            //        _posTeam[_iTeam] = position;
            //        _sideTeam[_iTeam++] = side;
            //    }
            //    else if ((System.Object) tag == (System.Object) "Substitute")
            //    {
            //        if (player.Injury > 0 || player.Suspension > 0)
            //        {
            //            //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'"
            //            throw new System.Xml.XmlException("Error: player " + player.name + " in team " + this.Name + " is unavailable for the match");
            //        }
            //        for (int j = 0; j < _iTeam; j++)
            //        {
            //            if (_team[j].name.Equals(player.name))
            //            {
            //                //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'"
            //                throw new System.Xml.XmlException("Error: player " + player.name + " is already present in teamsheet of team " + this.Name);
            //            }
            //        }
            //        for (int j = 0; j < _iSubs; j++)
            //        {
            //            if (_subs[j].name.Equals(player.name))
            //            {
            //                //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'"
            //                throw new System.Xml.XmlException("Error: player " + player.name + " is already present in teamsheet of team " + this.Name);
            //            }
            //        }
            //        _subs[_iSubs] = player;
            //        _posSubs[_iSubs] = position;
            //        _sideSubs[_iSubs++] = side;
            //    }
            //    else
            //    {
            //        for (int i = 0; i < _team.Length; i++)
            //            if (_team[i].Name.Equals(player.name))
            //                _penaltyKicker = _team[i];
            //        if (_penaltyKicker == null)
            //        {
            //            //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'"
            //            throw new System.Xml.XmlException("Error in PenaltyKicker, player can't be found in the teamsheet");
            //        }
            //    }
            //}
            //else if ((System.Object) tag == (System.Object) "Action")
            //    this._currentAction = attributes.GetValue("value");
            //else if ((System.Object) tag == (System.Object) "Argument")
            //    this._currentArguments.Add(attributes.GetValue("value"));
            //else if ((System.Object) tag == (System.Object) "Condition")
            //{
            //    string type = attributes.GetValue("type");
            //    /* What happens if the XML doesn't declare the attribute sign ? */
            //    string sign = attributes.GetValue("sign");
            //    string value_Renamed = attributes.GetValue("value");
            //    Condition C;
            //    if (type.Equals("MIN"))
            //        C = new MinCondition(sign, System.Int32.Parse(value_Renamed));
            //    else if (type.Equals("SCORE"))
            //        C = new ScoreCondition(sign, System.Int32.Parse(value_Renamed));
            //    else if (type.Equals("INJ"))
            //        C = new InjCondition(value_Renamed);
            //    else if (type.Equals("YELLOW"))
            //        C = new YellowCondition(value_Renamed);
            //    else if (type.Equals("RED"))
            //        C = new RedCondition(value_Renamed);
            //    else
            //    {
            //        //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'"
            //        throw new System.Xml.XmlException("", new System.Exception("Condition type not allowed"));
            //    }

            //    this._currentConditions.Add(C);
            //}
        }
		public virtual void  Import(SaxAttributesSupport attributes)
		{
			ImportRecord record = new ImportRecord();
			int id = parseInt(getAttribute(attributes, "id"));
			record.name = getAttribute(attributes, "name");
			
			ImportAssets importAssets = (ImportAssets) stack[stack.Count - 1];
			importAssets.importRecords.Add(record);
			
			// todo find the actual tag imported
			createCharacter(id, record);
		}
		private bool hasAttribute(SaxAttributesSupport attributes, System.String qName)
		{
			return attributes.GetValue(qName) != null;
		}
		public virtual void  line(SaxAttributesSupport attributes)
		{
			StraightEdgeRecord straightEdge = new StraightEdgeRecord();
			if (hasAttribute(attributes, "dx"))
			{
				straightEdge.deltaX = parseInt(getAttribute(attributes, "dx"));
			}
			if (hasAttribute(attributes, "dy"))
			{
				straightEdge.deltaY = parseInt(getAttribute(attributes, "dy"));
			}
			
			DefineShape defineShape = (DefineShape) stack[stack.Count - 1];
			defineShape.shapeWithStyle.shapeRecords.Add(straightEdge);
		}
		private System.String getAttribute(SaxAttributesSupport attributes, System.String qName)
		{
			System.String value_Renamed = attributes.GetValue(qName);
			if (value_Renamed == null)
			{
				//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
				error(new SAXParseException("attribute not found: " + qName, locator));
			}
			return value_Renamed;
		}
		public virtual void  swf(SaxAttributesSupport attributes)
		{
			Header h = new Header();
			h.version = parseInt(getAttribute(attributes, "version"));
			h.compressed = parseBoolean(getAttribute(attributes, "compressed"));
			h.rate = parseInt(getAttribute(attributes, "framerate"));
			h.size = parseRect(getAttribute(attributes, "size"));
			this.header = h;
			tagHandler.header(h);
			
			/*
			this.packageManager = new CompilerPackageManager(h.version, topLevel, 0);
			
			// register an asclassloader for the given aspath
			ASClassLoader asLoader = new ASClassLoader(aspath, false, null);
			asLoader.pm = packageManager;
			asLoader.debug = false;
			packageManager.addLoader(asLoader);
			packageManager.findType("String");
			
			MessageHandler.setThreadLocalMessageHandler(outputHandler);
			*/
		}
		public virtual void  curve(SaxAttributesSupport attributes)
		{
			CurvedEdgeRecord curvedEdge = new CurvedEdgeRecord();
			
			curvedEdge.controlDeltaX = parseInt(getAttribute(attributes, "cdx"));
			curvedEdge.controlDeltaY = parseInt(getAttribute(attributes, "cdy"));
			curvedEdge.anchorDeltaX = parseInt(getAttribute(attributes, "dx"));
			curvedEdge.anchorDeltaY = parseInt(getAttribute(attributes, "dy"));
			
			DefineShape defineShape = (DefineShape) stack[stack.Count - 1];
			defineShape.shapeWithStyle.shapeRecords.Add(curvedEdge);
		}
		public virtual void  ShowFrame(SaxAttributesSupport attributes)
		{
			currentHandler().showFrame(new ShowFrame());
			
			if (sprite != null)
			{
				sprite.framecount++;
			}
			else
			{
				header.framecount++;
			}
		}
		public virtual void  DebugID(SaxAttributesSupport attributes)
		{
			DebugID debugId = new DebugID(parseUUID(getAttribute(attributes, "uuid")));
			tagHandler.debugID(debugId);
		}
		public virtual void  PlaceObject2(SaxAttributesSupport attributes)
		{
			PlaceObject tag = new PlaceObject(flash.swf.TagValues_Fields.stagPlaceObject2);
			tag.depth = parseInt(getAttribute(attributes, "depth"));
			if (hasAttribute(attributes, "className"))
			{
				tag.ClassName = getAttribute(attributes, "className");
			}
			if (hasAttribute(attributes, "hasImage"))
			{
				tag.HasImage = getAttribute(attributes, "hasImage").Equals("true");
			}
			if (hasAttribute(attributes, "idref"))
			{
				int idref = parseInt(getAttribute(attributes, "idref"));
				tag.Ref = findCharacter(idref);
			}
			if (hasAttribute(attributes, "name"))
			{
				tag.Name = getAttribute(attributes, "name");
			}
			if (hasAttribute(attributes, "clipDepth"))
			{
				tag.ClipDepth = parseInt(getAttribute(attributes, "clipDepth"));
			}
			if (hasAttribute(attributes, "ratio"))
			{
				tag.Ratio = parseInt(getAttribute(attributes, "ratio"));
			}
			if (hasAttribute(attributes, "cxform"))
			{
				tag.Cxform = parseCXForm(getAttribute(attributes, "cxform"));
			}
			if (hasAttribute(attributes, "matrix"))
			{
				tag.Matrix = parseMatrix(getAttribute(attributes, "matrix"));
			}
			
			stack.Add(tag);
			text = new System.Text.StringBuilder();
		}
		private SwfImageUtils.JPEG loadJPEG(SaxAttributesSupport attributes)
		{
			if (hasAttribute(attributes, "encoding"))
			{
				if (!getAttribute(attributes, "encoding").Equals("base64"))
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					fatalError(new SAXParseException("unknown encoding " + getAttribute(attributes, "encoding"), locator));
				}
				if (hasAttribute(attributes, "src"))
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					fatalError(new SAXParseException("can only specify one of src or encoding attributes", locator));
				}
				
				text = new System.Text.StringBuilder();
			}
			else
			{
				text = null;
				if (!hasAttribute(attributes, "src"))
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					fatalError(new SAXParseException("must provide either src or encoding attribute", locator));
				}
				try
				{
					System.IO.FileInfo src = new System.IO.FileInfo(getAttribute(attributes, "src"));
					//UPGRADE_TODO: Constructor 'java.io.FileInputStream.FileInputStream' 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_javaioFileInputStreamFileInputStream_javalangString'"
					System.IO.FileStream input = new System.IO.FileStream(getAttribute(attributes, "src"), System.IO.FileMode.Open, System.IO.FileAccess.Read);
					sbyte[] image = new sbyte[(int) SupportClass.FileLength(src)];
					SupportClass.ReadInput(input, image, 0, image.Length);
					input.Close();
					SwfImageUtils.JPEG jpeg = new SwfImageUtils.JPEG(image, true);
					if (!jpeg.validate())
					{
						//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
						fatalError(new SAXParseException("Invalid JPEG data in " + src.Name, locator));
					}
					return jpeg;
				}
				catch (System.IO.IOException e)
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					//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'"
					throw new SAXParseException(e.Message, locator);
				}
			}
			return null;
		}
		public virtual void  ScriptLimits(SaxAttributesSupport attributes)
		{
			ScriptLimits tag = new ScriptLimits(parseInt(getAttribute(attributes, "maxRecursionLimit")), parseInt(getAttribute(attributes, "scriptTimeLimit")));
			currentHandler().scriptLimits(tag);
		}
		public virtual void  DefineBits(SaxAttributesSupport attributes)
		{
			if (jpegTables == null)
			{
				//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
				fatalError(new SAXParseException("DefineBits must follow JPEGTables", locator));
			}
			
			DefineBits db = new DefineBits(flash.swf.TagValues_Fields.stagDefineBits);
			int id = parseInt(getAttribute(attributes, "id"));
			createCharacter(id, db);
			
			SwfImageUtils.JPEG jpeg = loadJPEG(attributes);
			
			if (jpeg != null)
			{
				if (!ArrayUtil.equals(jpeg.table, jpegTables.data))
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					fatalError(new SAXParseException("JPEGTables data does not match, use DefineBitsJPEG2", locator));
				}
				db.data = jpeg.data;
			}
			stack.Add(db);
		}
Beispiel #51
0
 public override void startElement(System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
 {
     currentChars = "";
     dictRef      = "";
     //logger.debug("startElement: ", raw);
     //logger.debug("uri: ", uri);
     //logger.debug("local: ", local);
     //logger.debug("raw: ", raw);
     if ("isotope".Equals(local))
     {
         workingIsotope = createIsotopeOfElement(currentElement, atts);
     }
     else if ("isotopeList".Equals(local))
     {
         currentElement = getElementSymbol(atts);
     }
     else if ("abundance".Equals(local))
     {
         //logger.warn("Disregarding dictRef for now...");
     }
     else if ("scalar".Equals(local))
     {
         for (int i = 0; i < atts.GetLength(); i++)
         {
             if ("dictRef".Equals(atts.GetFullName(i)))
             {
                 dictRef = atts.GetValue(i);
             }
         }
     }
 }
		public virtual void  DefineBitsJPEG2(SaxAttributesSupport attributes)
		{
			DefineBits db = new DefineBits(flash.swf.TagValues_Fields.stagDefineBitsJPEG2);
			int id = parseInt(getAttribute(attributes, "id"));
			createCharacter(id, db);
			if (hasAttribute(attributes, "encoding"))
			{
				if (!getAttribute(attributes, "encoding").Equals("base64"))
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					fatalError(new SAXParseException("unknown encoding " + getAttribute(attributes, "encoding"), locator));
				}
				if (hasAttribute(attributes, "src"))
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					fatalError(new SAXParseException("can only specify one of src or encoding attributes", locator));
				}
				
				text = new System.Text.StringBuilder();
			}
			else
			{
				if (!hasAttribute(attributes, "src"))
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					fatalError(new SAXParseException("must provide either src or encoding attribute", locator));
				}
				
				System.IO.FileInfo src = new System.IO.FileInfo(getAttribute(attributes, "src"));
				
				try
				{
					//UPGRADE_TODO: Constructor 'java.io.FileInputStream.FileInputStream' 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_javaioFileInputStreamFileInputStream_javalangString'"
					System.IO.FileStream input = new System.IO.FileStream(getAttribute(attributes, "src"), System.IO.FileMode.Open, System.IO.FileAccess.Read);
					db.data = new sbyte[(int) SupportClass.FileLength(src)];
					SupportClass.ReadInput(input, db.data, 0, db.data.Length);
				}
				catch (System.IO.IOException e)
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					//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'"
					fatalError(new SAXParseException("Unable to load DefineBitsJPEG2 src " + src.Name + ":" + e.Message, locator));
				}
			}
			stack.Add(db);
		}
		public virtual void  DefineShape3(SaxAttributesSupport attributes)
		{
			DefineShape tag = new DefineShape(flash.swf.TagValues_Fields.stagDefineShape3);
			int id = parseInt(getAttribute(attributes, "id"));
			createCharacter(id, tag);
			tag.bounds = parseRect(getAttribute(attributes, "bounds"));
			tag.shapeWithStyle = new ShapeWithStyle();
			tag.shapeWithStyle.fillstyles = new System.Collections.ArrayList();
			tag.shapeWithStyle.linestyles = new System.Collections.ArrayList();
			tag.shapeWithStyle.shapeRecords = new System.Collections.ArrayList();
			
			stack.Add(tag);
			fillstyles = tag.shapeWithStyle.fillstyles;
			linestyles = tag.shapeWithStyle.linestyles;
		}
Beispiel #54
0
        public override void startElement(CMLStack xpath, System.String uri, System.String local, System.String raw, SaxAttributesSupport atts)
        {
            System.String name = raw;
            isELSYM = false;

            if ("list".Equals(name))
            {
                for (int i = 0; i < atts.GetLength(); i++)
                {
                    if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("sequence"))
                    {
                    }
                    else if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("connections"))
                    {
                        // assume that Atom's have been read
                        //logger.debug("Assuming that Atom's have been read: storing them");
                        base.storeAtomData();
                        connectionTable = true;
                        //logger.debug("Start Connection Table");
                    }
                    else if (atts.GetFullName(i).Equals("title") && atts.GetValue(i).Equals("connect"))
                    {
                        //logger.debug("New connection");
                        isBond = true;
                    }
                    else if (atts.GetFullName(i).Equals("id") && isBond)
                    {
                        connect_root = atts.GetValue(i);
                    }

                    // ignore other list items at this moment
                }
            }
            else
            {
                base.startElement(xpath, uri, local, raw, atts);
            }
        }