Пример #1
0
        ///
        ///	 <summary> * Append a Merged audit element
        ///	 *  </summary>
        ///	 * <param name="merged"> the merged node </param>
        ///	 * <param name="rRefsOverwritten"> a vector of rRefs that are overwritten </param>
        ///	 * <param name="by"> the author keyword
        ///	 *  </param>
        ///	 * <returns> JDFMerged - the newly created Merged audit
        ///	 *
        ///	 *         default: AddMerged(merged, rRefsOverwritten, JDFConstants.EMPTYSTRING, null) </returns>
        ///
        public virtual JDFMerged addMerged(JDFNode merged, VString rRefsOverwritten, string by, VJDFAttributeMap vmParts)
        {
            VString rRefsOverwrittenLocal = rRefsOverwritten;

            JDFMerged mergedAudit = (JDFMerged)addAudit(JDFAudit.EnumAuditType.Merged, by);

            mergedAudit.setjRef(merged.getID());
            if (rRefsOverwrittenLocal != null && rRefsOverwrittenLocal.IsEmpty())
            {
                rRefsOverwrittenLocal = null;
            }
            mergedAudit.setrRefsOverwritten(rRefsOverwrittenLocal);

            mergedAudit.setPartMapVector(vmParts);
            return(mergedAudit);
        }
Пример #2
0
        ///
        ///	 <summary> * remove any internal "../" "./" and "//" from a url
        ///	 *  </summary>
        ///	 * <param name="url"> the url to clean </param>
        ///	 * <returns> String - the clean path </returns>
        ///
        public static string cleanDots(string url)
        {
            if (url == null)
            {
                return(null);
            }
            string dummy     = url;
            int    posDouble = url.IndexOf("//");
            string prefix    = url.StartsWith("/") ? "/" : "";

            if (posDouble >= 0)
            {
                prefix = url.Substring(0, posDouble + 2);
                dummy  = url.Substring(posDouble + 2);
            }
            VString vs = new VString(StringUtil.tokenize(dummy, "/", false));

            for (int i = vs.Count - 1; i > 0; i--)
            {
                if (vs.stringAt(i).Equals("") || vs.stringAt(i).Equals("."))
                {
                    vs.RemoveAt(i);
                }
            }
            for (int i = vs.Count - 1; i > 0; i--)
            {
                if (vs.stringAt(i).Equals(".."))
                {
                    for (int j = i - 1; j >= 0; j--)
                    {
                        if (!vs.stringAt(j).Equals(".."))
                        {
                            vs.RemoveAt(i--);
                            vs.RemoveAt(j);
                            break;
                        }
                    }
                }
            }

            return(prefix + (vs.IsEmpty() ? "." : StringUtil.setvString(vs, "/", null, null)));
        }
Пример #3
0
        ///
        ///	 <summary> * Append a Spawned audit element
        ///	 *  </summary>
        ///	 * <param name="spawned"> the spawned node </param>
        ///	 * <param name="rRefsRO"> a vector of rRefs that are spawned read-only </param>
        ///	 * <param name="rRefsRW"> a vector of rRefs that are spawned read-write </param>
        ///	 * <param name="by"> the author keyword </param>
        ///	 * <param name="vmParts">
        ///	 *  </param>
        ///	 * <returns> JDFAudit - the newly created Spawned audit
        ///	 *
        ///	 *         default: AddSpawned(spawned, new Vector(), new Vector(), JDFConstants.EMPTYSTRING, new
        ///	 *         VJDFAttributeMap()) </returns>
        ///
        public virtual JDFSpawned addSpawned(JDFNode spawned, VString rRefsRO, VString rRefsRW, string by, VJDFAttributeMap vmParts)
        {
            JDFSpawned a = (JDFSpawned)addAudit(JDFAudit.EnumAuditType.Spawned, by);

            a.setAttribute(JDFConstants.JREF, spawned.getID(), null);
            string ms = null;

            if (rRefsRO != null && !rRefsRO.IsEmpty())
            {
                ms = StringUtil.setvString(rRefsRO);
                a.setAttribute(AttributeName.RREFSROCOPIED, ms, null);
            }

            if (rRefsRW != null && !rRefsRW.IsEmpty())
            {
                ms = StringUtil.setvString(rRefsRW);
                a.setAttribute(AttributeName.RREFSRWCOPIED, ms, null);
            }

            a.setPartMapVector(vmParts);

            return(a);
        }