Ejemplo n.º 1
0
        /*
         *  The XTag function is need to add extra functionality to JCR Dir and is called by JCR_Dir if these extra functions are actually used.
         *
         *  (Well, the need of this XTag function lead to JCR5 becoming really really ugly, and that eventually lead to me realizing that if JCR5 would ever be able to do more a more flexible format was needed, hence the birth of JCR6. ;)
         *
         */
        void XTag(QuickStream BT, TJCRDIR JCR, bool LoadComments, string JCRFile)
        {
            string XTC;  // Stands for 'XTag Command'. I'm not promoting any sorts of stuff here(in fact I recommend not to use that) :P
            var    Length = BT.ReadInt();

            XTC = BT.ReadString(Length).ToUpper();
            string  F;
            TJCRDIR J;
            var     D = System.IO.Path.GetDirectoryName(JCRFile).Replace(@"\", "/"); //Replace(ExtractDir(JCRFile),"\","/"); If D And Right(D,1)<>"/" D:+"/"

            if (D != "" && qstr.Right(D, 1) != "/")
            {
                D += "/";
            }
            //'JCRD_Print "XTag: "+XTC
            switch (XTC)
            {
            case "IMP":
            case "IMPORT":
                Length = BT.ReadInt();
                F      = BT.ReadString(Length).Replace("\\", "/");
                if (qstr.Left(F, 1) != "/" && qstr.Mid(F, 2, 1) != ":" && System.IO.File.Exists(D + F))
                {
                    F = D + F;       //' If the required file to import is found in the same directory than hit that file.
                }
                J = JCR6.Dir(F);     //' ,LoadComments)
                if (J == null)
                {
                    //'JCRD_Print "WARNING! Could not import "+F+"~n= Report: "+JCRD_DumpError
                }
                else
                {
                    //'JCRD_Print "Importing: "+F
                    //'For Local K$=EachIn MapKeys(J)
                    //'   MapInsert JCR,K,MapValueForKey(J,K)
                    //'   Next
                    JCR.Patch(J);
                }
                break;

            default:
                JCR_JAMERR("WARNING! Unknown XTag in JCR file!", "?", "?", "XTAG");
                break;
            }
        }