예제 #1
0
        ///
        ///	 <summary> * does this ColorPool have Color elements with identical Name or RawName
        ///	 * eattributes return false if no Color elements with identical Name or
        ///	 * RawName tags exist </summary>
        ///
        public virtual VString getDuplicateColors()
        {
            VElement v = getChildElementVector(ElementName.COLOR, null, null, true, 0, false);

            SupportClass.HashSetSupport <string> vName = new SupportClass.HashSetSupport <string>();
            int     nCols = v.Count;
            VString vRet  = new VString();

            for (int i = 0; i < nCols; i++)
            {
                JDFColor color     = (JDFColor)v[i];
                string   colorName = color.getName();
                if (vName.Contains(colorName))
                {
                    vRet.appendUnique(colorName);
                }
                string rawName = color.get8BitName();
                if (vName.Contains(rawName))
                {
                    vRet.appendUnique(colorName);
                }
                vName.Add(colorName);
                vName.Add(rawName);
            }

            return(vRet.Count == 0 ? null : vRet);
        }
예제 #2
0
        public virtual void testSetRawName()
        {
            JDFColor c = cp.appendColor();

            byte[] b = Encoding.Default.GetBytes("grün");
            c.set8BitNames(b);
            Assert.AreEqual("grün", c.get8BitName());
        }
예제 #3
0
        ///
        ///	 <summary> * Get the Color Element with RawName=rawName or Name=rawName in the
        ///	 * momentary encoding
        ///	 *  </summary>
        ///	 * <param name="String">
        ///	 *            rawName the 8 bit representation of the rawName of the color
        ///	 *  </param>
        ///	 * <returns> JDFColor the color with the matching name, null if no matching
        ///	 *         element exists </returns>
        ///
        public virtual JDFColor getColorWith8BitName(string rawName)
        {
            VElement v = getChildElementVector(ElementName.COLOR, null, null, true, 0, false);

            for (int i = 0; i < v.Count; i++)
            {
                JDFColor c        = (JDFColor)v[i];
                string   pRawName = Encoding.Default.GetString(StringUtil.getRawBytes(c.get8BitName()));
                if (pRawName.Equals(rawName))
                {
                    return(c);
                }
            }

            return(null);
        }