예제 #1
0
        public static void AddBus(BusContext db, string number, string seated, string standing)
        {
            var seatingCapacity  = int.Parse(seated);
            var standingCapacity = int.Parse(standing);

            var id = new BusId(Guid.NewGuid());
            var b  = new Bus(id, number, seatingCapacity, standingCapacity);

            db.Add(b.State);
            db.SaveChanges();
        }
예제 #2
0
        public MAX7219(int numberOfPanels = 1, Rotate rotate = Rotate.None, Transform transform = Transform.None, ChipSelect chipSelect = ChipSelect.CE0, BusId busId = BusId.BusId0)
        {
            this.PanelsPerFrame = numberOfPanels < 0 ? 0 : numberOfPanels;
            this.rotate         = rotate;
            this.transform      = transform;
            this.chipSelect     = chipSelect;
            this.busId          = busId;

            SendDataBytes = new byte[2 * PanelsPerFrame];

            InitializeSpi();
            InitializeDisplay();
        }
예제 #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (BusId != 0)
            {
                hash ^= BusId.GetHashCode();
            }
            if (NumaNode != 0)
            {
                hash ^= NumaNode.GetHashCode();
            }
            if (links_ != null)
            {
                hash ^= Links.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #4
0
 public override string ToString()
 {
     return($"GpuIndex={GpuIndex.ToString()},BusId={BusId.ToString()},Name={Name},TotalMemory={TotalMemory.ToString()}");
 }