Example #1
0
        private void Form_TestOps_Load(object sender, EventArgs e)
        {
            // This application will unlikely detect data fragment lost errors.
            // But the statement provides a sample of the global OPS settings.
            Ops.Globals.REPORT_DATA_FRAGMENT_LOST_ERRORS = true;

            // Set up a logger for errors reported from OPS, to capture all errors and show them in our logarea
            new OpsErrorLogger(this);

            // Set up a text file logger for errors reported from OPS.
            ///Logger.ExceptionLogger.AddLogger(new TextFileLogger(Path.GetDirectoryName(Application.ExecutablePath) + "\\Log.txt"));

            ///TODO to be filled from existing items in config file??
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "PizzaTopic", "pizza.PizzaData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "VessuvioTopic", "pizza.VessuvioData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "PizzaTopic2", "pizza.PizzaData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "VessuvioTopic2", "pizza.VessuvioData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "TcpPizzaTopic", "pizza.PizzaData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "TcpVessuvioTopic", "pizza.VessuvioData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "TcpPizzaTopic2", "pizza.PizzaData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "TcpVessuvioTopic2", "pizza.VessuvioData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "UdpPizzaTopic", "pizza.PizzaData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "UdpVessuvioTopic", "pizza.VessuvioData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "UdpPizzaTopic2", "pizza.PizzaData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "UdpVessuvioTopic2", "pizza.VessuvioData"));
            MyTopicInfoList.Add(new MyTopicInfo("OtherPizzaDomain", "OtherPizzaTopic", "pizza.PizzaData"));
            MyTopicInfoList.Add(new MyTopicInfo("OtherPizzaDomain", "OtherVessuvioTopic", "pizza.VessuvioData"));
            MyTopicInfoList.Add(new MyTopicInfo("PizzaDomain", "ExtraAlltTopic", "pizza.special.ExtraAllt"));

            // Fill in the listbox and create the needed helper objects
            foreach (MyTopicInfo info in MyTopicInfoList)
            {
                checkedListBoxTopics.Items.Add(info);

                if (info.TypeName == PizzaData.GetTypeName())
                {
                    Pizza.Add(new COpsHelper <PizzaData>(this));
                    info.Index     = Pizza.Count - 1;
                    info.OpsHelper = Pizza[info.Index];
                }
                if (info.TypeName == VessuvioData.GetTypeName())
                {
                    Vessuvio.Add(new COpsHelper <VessuvioData>(this));
                    info.Index     = Vessuvio.Count - 1;
                    info.OpsHelper = Vessuvio[info.Index];
                }
                if (info.TypeName == ExtraAllt.GetTypeName())
                {
                    ExAllt.Add(new COpsHelper <ExtraAllt>(this));
                    info.Index     = ExAllt.Count - 1;
                    info.OpsHelper = ExAllt[info.Index];
                }
            }
            checkedListBoxTopics.SetItemChecked(0, true);
            textBoxPizzaDataVersion.Text = "" + pizza.PizzaData.PizzaData_idlVersion;
        }
Example #2
0
        public void SubscriberNewData(Subscriber sender, ExtraAllt data)
        {
            OPSMessage mess = sender.GetMessage();

            String str = "";

            if (data.shs.Count > 1)
            {
                str = ", shs[1]: " + data.shs.ElementAt(1);
            }

            Log("[Topic: " + sender.GetTopic().GetName() + "] ExtraAllt:: Cheese: " + data.cheese +
                ", Tomato sauce: " + data.tomatoSauce +
                str +
                ", Num strings: " + data.strings.Count() +
                ", From " + mess.GetSourceIP() + ":" + mess.GetSourcePort());
        }