public new void Add(Transition t)
        {
            if (t.P == null || t.Q == null)
            {
                throw new NullReferenceException("Null state not allowed!");
            }
            if (Contains(t))
            {
                return;
            }

            Trans.Add(t);
        }
Exemplo n.º 2
0
        //списание средств
        public async void WithdrawTransaction(int delay)

        {
            while (true)
            {
                if (Cars.Count > 0)

                {
                    foreach (var car in Cars)
                    {
                        var tarif = 0;
                        switch (car.TypeofCar)
                        {
                        case Car.CarTypes.Passanger:
                            tarif = Tarif[Car.CarTypes.Passanger];
                            break;

                        case Car.CarTypes.Bus:
                            tarif = Tarif[Car.CarTypes.Bus];
                            break;

                        case Car.CarTypes.Truck:
                            tarif = Tarif[Car.CarTypes.Truck];
                            break;

                        case Car.CarTypes.Moto:
                            tarif = Tarif[Car.CarTypes.Moto];
                            break;

                        default:
                            break;
                        }

                        if (car.Balance < tarif)
                        {
                            tarif = tarif + (tarif * Fine);
                        }

                        car.Balance    = car.Balance - tarif;
                        ParkingBalance = ParkingBalance + tarif;

                        var transaction = new Transaction(DateTime.Now, car.ID, tarif);
                        Trans.Add(transaction);
                    }
                }

                await Task.Delay(delay);
            }
        }
Exemplo n.º 3
0
        protected IPatch Patch(MethodBase method, string prefix = null, string postfix = null, string transpiler = null)
        {
            IPatch patch;

         #if ZyBatch
            try {
         #endif
            lock (_ILock) if (Patcher == null)
                {
                    Patcher = HarmonyInstance.Create(GetType().Namespace);
                }
            patch = new PatchRecord(Patcher, method, ToHarmony(prefix), ToHarmony(postfix), ToHarmony(transpiler)).Patch();
         #if ZyBatch
        }
        catch (Exception ex) { RollbackPatch(ex); throw; }
        lock (Trans) if (TransId != null)
            {
                Trans.Add(patch);
            }
         #endif
            return(patch);
        }