Beispiel #1
0
 public LogOptions()
 {
     this.InitializeComponent();
     this._settingsPersister          = new SettingsPersisterTrunker();
     this._trunkerConfig              = this._settingsPersister.readConfig();
     this._trunkLoggerData            = new TrunkerLogger();
     this.guideLabel.Text             = "Guide:" + Environment.NewLine + "%t = targetlabel" + Environment.NewLine + "%tid = targetid" + Environment.NewLine + "%s = sourcelabel" + Environment.NewLine + "%sid = sourceid" + Environment.NewLine + "%f = frequency (Hz)" + Environment.NewLine + "%fk  = frequency (kHz)" + Environment.NewLine + "%fm  = frequency (MHz)" + Environment.NewLine + "%a = action" + Environment.NewLine + "%r = receiver";
     this.guideLabel2.Text            = "To filter strings based on variable availabity, use brackets. Please try some presets from the dropdown list above, as well as the simulator for examples on how this works." + Environment.NewLine + "Nested filters are not currently supported." + Environment.NewLine + "Only works on %tid, %s, and %sid.";
     this.logSimulation.SelectedIndex = 0;
     this.logStyle.Text        = (this._trunkerConfig[0].logStyle ?? "%t %fm MHz");
     this.parkedString.Text    = (this._trunkerConfig[0].parkedStr ?? "Parked");
     this.unkString.Text       = (this._trunkerConfig[0].unknownSrcStr ?? "Unknown");
     this.ignoreParked.Checked = this._trunkerConfig[0].ignoreParked;
 }
Beispiel #2
0
 public TrunkerPanel(ISharpControl control, TrunkerPlugin _parentplug)
 {
     this.InitializeComponent();
     this._version          = Assembly.GetExecutingAssembly().GetName().Version.ToString() + " ZefieMod";
     this._plugin           = _parentplug;
     this._controlInterface = control;
     this._cachedAudioGain  = this._controlInterface.AudioGain;
     this._controlInterface.PropertyChanged += this._controlInterface_PropertyChanged;
     this._fftSpectrum       = new byte[this._controlInterface.FFTResolution];
     this._settingsPersister = new SettingsPersisterTrunker();
     this._trunkerConfig     = this._settingsPersister.readConfig();
     this._trunkLoggerData   = new TrunkerLogger();
     this.setVersion();
     this._sdrsharp_rev_1133 = this.isRev1133orBetter;
     this.ProcessSavedSettings();
     this.initializing = false;
 }
Beispiel #3
0
 private static TrunkerLogger PrepareLogData(TrunkerLogger _trunkLoggerData, string parkedStr, string unkString)
 {
     if (_trunkLoggerData.currentAction == "Park")
     {
         _trunkLoggerData.currentTrunklabel = parkedStr;
     }
     if (_trunkLoggerData.currentAction == "Listen")
     {
         if (_trunkLoggerData.currentTrunklabel == null || _trunkLoggerData.currentTrunklabel.Length == 0)
         {
             _trunkLoggerData.currentTrunklabel = _trunkLoggerData.currentTrunkgroup;
         }
         if (_trunkLoggerData.currentSourcelabel == null || _trunkLoggerData.currentSourcelabel.Length == 0)
         {
             _trunkLoggerData.currentSourcelabel = _trunkLoggerData.currentSourcegroup;
         }
         if (_trunkLoggerData.currentSourcelabel == null || _trunkLoggerData.currentSourcelabel.Length == 0)
         {
             _trunkLoggerData.currentSourcelabel = unkString;
         }
     }
     return(_trunkLoggerData);
 }
Beispiel #4
0
 private void PrepareLog()
 {
     this._trunkLoggerData = null;
     this._trunkLoggerData = new TrunkerLogger();
 }
Beispiel #5
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));
        }