Beispiel #1
0
        public override void Start()
        {
            cumulus.CurrentActivity = "Normal running";
            StationListener.WeatherPacketReceived = WeatherPacketReceived;
            StationListener.Start(cumulus);
            DoDayResetIfNeeded();
            DoTrendValues(DateTime.Now);

            cumulus.StartTimersAndSensors();
        }
Beispiel #2
0
        protected override void Run(CommandArgs args)
        {
            if (args.Arg == "#" && args.IsAdmin)
            {
                args.Callback(
                    "Listener status\n" +
                    $"IsRunning : {listener.Running}\n" +
                    $"IsActive : {listener.Active}\n" +
                    $"Cars : {listener.Cars.Count}\n" +
                    $"");
            }
            if (!string.IsNullOrEmpty(args.Arg))
            {
                return;
            }
            lock (listener)
                if (!listener.Running)
                {
                    listener.Start();
                }

            string        result  = "";
            List <Car>    cars    = listener.Cars;
            HashSet <int> indexes = new HashSet <int>();

            foreach (Car car in cars)
            {
                if (indexes.Contains(car.index))
                {
                    continue;
                }
                indexes.Add(car.index);
                result +=
                    car.rawmessage +
                    $"({(int)(DateTime.Now - car.time).TotalSeconds}秒前)" +
                    "\n";
            }
            args.Callback(string.IsNullOrEmpty(result) ? "myc" : result.Substring(0, result.Length - 1));
        }
Beispiel #3
0
        public void Run(CommandArgs args)
        {
            if (!string.IsNullOrEmpty(args.Arg))
            {
                return;
            }
            lock (listener)
                if (!listener.Running)
                {
                    listener.Start();
                }

            List <Car> cars = Configuration.GetConfig <CarTypeConfig>()[args.Source.FromGroup] switch
            {
                CarType.Bandori => listener.Cars,
                CarType.Sekai => CarHandler.Cars
            };

            string        result  = "";
            HashSet <int> indexes = new HashSet <int>();

            foreach (Car car in cars)
            {
                if (indexes.Contains(car.index))
                {
                    continue;
                }
                indexes.Add(car.index);
                result +=
                    car.rawmessage +
                    $"({(int)(DateTime.Now - car.time).TotalSeconds}秒前)" +
                    "\n";
            }
            args.Callback(string.IsNullOrEmpty(result) ? "myc" : result.Substring(0, result.Length - 1));
        }
    }
Beispiel #4
0
 public YCM()
 {
     listener = new StationListener();
     listener.Start();
 }
Beispiel #5
0
 public YCM()
 {
     listener           = new StationListener();
     listener.OnNewCar += car => OnNewCar?.Invoke(car);
     listener.Start();
 }