Exemple #1
0
        private string OnMacroExecute(string sName)
        {
            helpers.replica.mam.Macro.Flags eFlags = helpers.replica.mam.Macro.ParseFlags(ref sName);
            string     sRetVal = "";
            DBInteract cDBI    = new DBInteract();
            Macro      cMacro  = Macro.Get(sName);

            switch (cMacro.cType.sName)
            {
            case "sql":
                sRetVal = cMacro.Execute().FromDB();
                break;

            default:
                throw new Exception("обнаружен неизвестный тип макро-строки [" + cMacro.cType.sName + "] в темплейте [" + sFile + "]");     //TODO LANG
            }
            if (null != sRetVal)
            {
                if (eFlags.HasFlag(helpers.replica.mam.Macro.Flags.Escaped))
                {
                    sRetVal = sRetVal.Replace("\\", "\\\\").Replace("\"", "\\\"");
                }
                if (eFlags.HasFlag(helpers.replica.mam.Macro.Flags.Caps))
                {
                    sRetVal = sRetVal.ToUpper();
                }
            }
            return(sRetVal);
        }
Exemple #2
0
        string OnRuntimeGetUserCues(string sKey)
        {
            string sRetVal = null;

            helpers.replica.mam.Macro.Flags eFlags = helpers.replica.mam.Macro.ParseFlags(ref sKey);
            if (null != ahUserCues)
            {
                if (ahUserCues.Keys.Contains(sKey))
                {
                    sRetVal = ahUserCues[sKey];
                }
                else if (sKey.Contains("ARTIST") && ahUserCues.Keys.Contains("ARTIST"))
                {
                    sRetVal = ahUserCues["ARTIST"];
                }
                else if (sKey.Contains("SONG") && ahUserCues.Keys.Contains("SONG"))
                {
                    sRetVal = ahUserCues["SONG"];
                }
                else if (sKey.Contains("FOLDER") && ahUserCues.Keys.Contains("FOLDER"))
                {
                    sRetVal = ahUserCues["FOLDER"];
                }
                else if (sKey.Contains("LOOPS") && ahUserCues.Keys.Contains("LOOPS"))
                {
                    sRetVal = ahUserCues["LOOPS"];
                }

                if (null != sRetVal)
                {
                    if (eFlags.HasFlag(helpers.replica.mam.Macro.Flags.Escaped))
                    {
                        sRetVal = sRetVal.Replace("\\", "\\\\").Replace("\"", "\\\"");
                    }
                    if (eFlags.HasFlag(helpers.replica.mam.Macro.Flags.Caps))
                    {
                        sRetVal = sRetVal.ToUpper();
                    }
                    return(sRetVal);
                }
            }
            throw new Exception("обнаружен запрос неизвестного runtime-свойства [" + sKey + "] в темплейте [" + sFile + "]");             //TODO LANG
        }