Esempio n. 1
0
 private void writeSingleLog()
 {
     if (this.singleLogFilePath.Text != null && this.loggingEnabled)
     {
         string text = LogParser.ParseLogStyle(this._trunkLoggerData, null, null, null, false);
         if (text != null)
         {
             this.versionAndStatus.Text = text;
             this.WriteLog(text, this.singleLogFilePath.Text);
         }
     }
 }
Esempio n. 2
0
 private string doLogParse()
 {
     return(LogParser.ParseLogStyle(this._trunkLoggerData, this.logStyle.Text, this.parkedString.Text, this.unkString.Text, this.ignoreParked.Checked));
 }
Esempio n. 3
0
        public static string ParseLogStyle(TrunkerLogger _trunkLoggerData, string logStyle = null, string parkedString = null, string unkString = null, bool ignoreParked = false)
        {
            if (logStyle == null || parkedString == null || unkString == null || !ignoreParked)
            {
                string[] settings = LogParser.getSettings();
                if (logStyle == null)
                {
                    logStyle = settings[0];
                }
                if (parkedString == null)
                {
                    parkedString = settings[1];
                }
                if (unkString == null)
                {
                    unkString = settings[2];
                }
                if (!ignoreParked)
                {
                    ignoreParked = Convert.ToBoolean(settings[3]);
                }
            }
            _trunkLoggerData = LogParser.PrepareLogData(_trunkLoggerData, parkedString, unkString);
            if (_trunkLoggerData.currentAction == "Park" && ignoreParked)
            {
                return(null);
            }
            string text = logStyle;
            int    num  = -1;
            int    num2 = num;

            while (true)
            {
                if (num + 1 > text.Length)
                {
                    break;
                }
                num = text.IndexOf('[', num + 1);
                if (num < 0)
                {
                    break;
                }
                int num3 = text.IndexOf(']', num);
                if (num3 >= 0)
                {
                    string text2 = text.Substring(num, num3 - num + 1);
                    string text3 = text2;
                    int    num4  = text2.IndexOf('%');
                    if (num4 > 0)
                    {
                        string text4 = (text3.Length < num4 + 4) ? text2.Substring(num4, 2) : text2.Substring(num4, 4);
                        switch (text4)
                        {
                        case "%tid":
                            text3 = LogParser.filterData(text2, text4, _trunkLoggerData.currentTrunkgroup);
                            break;

                        case "%sid":
                            text3 = LogParser.filterData(text2, text4, _trunkLoggerData.currentSourcegroup);
                            break;

                        default:
                        {
                            text4 = text4.Substring(0, 2);
                            string a;
                            if ((a = text4) != null && a == "%s")
                            {
                                text3 = LogParser.filterData(text2, text4, _trunkLoggerData.currentSourcelabel);
                            }
                            break;
                        }
                        }
                        if (text2 != text3)
                        {
                            text = text.Replace(text2, text3);
                        }
                    }
                    num2 = num3;
                }
                if (num2 <= num)
                {
                    break;
                }
                num = num2;
            }
            text = text.Replace("%fk", (_trunkLoggerData.currentFrequency / 1000m).ToString());
            text = text.Replace("%fm", (_trunkLoggerData.currentFrequency / 1000000m).ToString());
            text = text.Replace("%f", _trunkLoggerData.currentFrequency.ToString());
            text = text.Replace("%tid", _trunkLoggerData.currentTrunkgroup);
            text = text.Replace("%t", _trunkLoggerData.currentTrunklabel);
            text = text.Replace("%sid", _trunkLoggerData.currentSourcegroup);
            text = text.Replace("%s", _trunkLoggerData.currentSourcelabel);
            text = text.Replace("%r", _trunkLoggerData.currentReceiver);
            return(text.Replace("%a", _trunkLoggerData.currentAction));
        }