Exemple #1
0
        private string GetResStr(string keyname, params IExpression[] parameter)
        {
            string source = "Res-";

            switch (this.LogType)
            {
            case OutputType.String:
                source += "str";
                break;

            case OutputType.Mathjax:
                source += "mathjax";
                break;

            default:
                throw new NotImplementedException();
            }

            string str = GetRes.Text(source, keyname);

            switch (this.LogType)
            {
            case OutputType.Mathjax:
                if (keyname.StartsWith("_"))
                {
                    str = " $ " + str + " $ ";
                }
                break;
            }

            List <object> prm = new List <object>();

            for (int i = 0; i < parameter.Length; i++)
            {
                if (parameter[i] is IOutput)
                {
                    string st = "";

                    switch (this.LogType)
                    {
                    case OutputType.Mathjax:
                        if (keyname.StartsWith("_"))
                        {
                            st = ((parameter[i] as IOutput).Output(this.LogType));
                        }
                        else
                        {
                            st = (" $ " + (parameter[i] as IOutput).Output(this.LogType) + " $ ");
                        }
                        break;

                    default:
                        st = ((parameter[i] as IOutput).Output(this.LogType));
                        break;
                    }

                    str = str.Replace("{" + i + "}", st);
                }
                else
                {
                    prm.Add(parameter[i].ToString());
                }
            }


            return(str);
        }
Exemple #2
0
 public void AddLogCondition(string keyname, params IExpression[] parameter)
 {
     this.setting.Logger.AddCondition(GetRes.Text("Res", "But") + GetResStr(keyname, parameter));
 }