Beispiel #1
0
        public double GetPrice()
        {
            double _total = 0.0;

            _total += PCCase.GetPrice();
            _total += Motherboard.GetPrice();
            _total += CPU.GetPrice();
            _total += GPU.GetPrice() * (double)GPUCount;
            _total += PSU.GetPrice();
            foreach (RAM r in BuildsRAMs.Select(x => x.RAM).ToArray())
            {
                _total += r.GetPrice();
            }
            if (BuildDisks != null)
            {
                foreach (HardDrive d in BuildDisks.Select(x => x.HardDrive).ToArray())
                {
                    _total += d.GetPrice();
                }
            }
            if (BuildODs != null)
            {
                foreach (OpticalDriver o in BuildODs.Select(x => x.OpticalDriver).ToArray())
                {
                    _total += o.GetPrice();
                }
            }
            if (BuildMonitors != null)
            {
                foreach (Monitor m in BuildMonitors.Select(x => x.Monitor).ToArray())
                {
                    m.GetPrice();
                }
            }
            if (BuildPCIs != null)
            {
                foreach (PCICard c in BuildPCIs.Select(x => x.PCICard).ToArray())
                {
                    _total += c.GetPrice();
                }
            }
            if (BuildsPeripherals != null)
            {
                foreach (Peripheral p in BuildsPeripherals.Select(x => x.Peripheral).ToArray())
                {
                    _total += p.GetPrice();
                }
            }

            return(_total);
        }
Beispiel #2
0
        public List <string[]> GetCompat()
        {
            RAM[] _ram         = BuildsRAMs.Select(x => x.RAM).ToArray();
            byte? _ramCount    = 0;
            int?  _ramCap      = 0;
            int?  TotalWattage = 0;

            //byte _3 = Convert.ToByte(BuildODs.Select(x => x.OpticalDriver).ToArray().Length + BuildDisks.Select(x => x.HardDrive).Where(x => x.SlotSize == true).ToArray().Length);
            //byte _2 = (byte)BuildDisks.Select(x => x.HardDrive).Where(x => !x.SlotSize == true).ToArray().Length;
            //byte _x = Convert.ToByte(GPUCount + BuildPCIs.Select(x => x.PCICard).ToArray().Length);
            foreach (RAM r in _ram)
            {
                _ramCount += r.Quantity;
                _ramCap   += r.TotalCapacity;
                //TotalWattage += r.Voltage * AMPERAGE;
            }
            //TotalWattage += GPU.Wattage * GPUCount;
            //TotalWattage += Motherboard.Wattage + CPU.Wattage;

            /*
             * foreach (PCICard p in BuildPCIs.Select(x => x.PCICard).ToArray())
             * {
             *  TotalWattage += p.Wattage;
             * }
             * foreach (HardDrive p in BuildDisks.Select(x => x.HardDrive).ToArray())
             * {
             *  TotalWattage += p.Wattage;
             * }
             * foreach (OpticalDriver p in BuildODs.Select(x => x.OpticalDriver).ToArray())
             * {
             *  TotalWattage += p.Wattage;
             * }
             */

            List <string[]> _out = new List <string[]>();

            if (Motherboard.Socket != CPU.Socket)
            {
                _out.Add(new string[] { "Socket Mismatch", $"Your motherboard has a {Motherboard.Socket} socket and your CPU has a {CPU.Socket}" });
                //Add more specific error
            }
            //MB and RAM
            if (Motherboard.RAMSlots < _ramCount && (Motherboard.RAMSlots != null && _ramCount != null))
            {
                _out.Add(new string[] { "RAM Quantity Error (MB)", $"You have {_ramCount - Motherboard.RAMSlots} too many sticks of RAM (Non-Fatal)" });
            }
            for (int i = 0; i < _ram.Length; i++)
            {
                if (Motherboard.RAMType != _ram[i].RAMType)
                {
                    _out.Add(new string[] { $"RAM Type Error {i + 1}", $"Your RAM selection in index {i + 1} does not match the motherboard's type." });
                }
            }
            //MB and GPU(s)
            if (Motherboard.PCISlots < GPUCount + BuildPCIs.Select(x => x.PCICard).ToArray().Length)
            {
                _out.Add(new string[] { "PCI Quantity Error", "Your motherboard cannot support this many GPUs and PCI Cards." });
            }
            if (GPU.MultiGPUType == true)   //True is SLI
            {
                if (GPUCount > Motherboard.SLILimit || GPUCount > GPU.MultiGPULimit)
                {
                    _out.Add(new string[] { "SLI Error", "You have too many GPUs for your build. You are too powerful." });
                }
            }
            if (GPU.MultiGPUType == false)
            {
                if (GPU.MultiGPULimit > Motherboard.CrossfireLimit)
                {
                    _out.Add(new string[] { "Crossfire Error", "You have too many GPUs for your build. You are too powerful." });
                }
            }
            //CPU and RAM
            if (CPU.MaxRAM < _ramCap)
            {
                _out.Add(new string[] { "RAM Capacity Error", "Your CPU cannot handle this amount of RAM (Fatal)." });
            }
            //Case and MB
            //if (!PCCase.Style.Contains(Motherboard.FormFactor))
            //{
            //    _out.Add(new string[] { "Form Factor Mismatch", $"Your case does not support {Motherboard.FormFactor} motherboards." });
            //}
            //Case and PSU
            if (PSU.Width > PCCase.Width || PSU.Length > PCCase.Length || PSU.Height > PCCase.Height)
            {
                _out.Add(new string[] { "PSU Dim Error", "Your power supply is too large for your case." });
            }
            //Case and Drives
            //if (PCCase.ThreeSlots < _3)
            //{
            //    _out.Add(new string[] { "3.5\" Drive Error", "Your case cannot hold this many 3.5\" drives (Non-Fatal)" });
            //}
            //if (PCCase.TwoSlots < _2)
            //{
            //    _out.Add(new string[] { "2.5\" Drive Error", "Your case cannot hold this many 2.5\" drives (Non-Fatal)" });
            //}
            //MB and Drives
            if (Motherboard.SATASlots < BuildDisks.Select(x => x.HardDrive).ToArray().Length + BuildODs.Select(x => x.OpticalDriver).ToArray().Length)
            {
                _out.Add(new string[] { "Too Many SATAs", "Your build has too many SATA drives for your motherboard (Non-Fatal)." });
            }
            //GPU and Monitors

            //Final Boss: PSU and Total
            if (TotalWattage > PSU.Wattage)
            {
                _out.Add(new string[] { "Brown", "Your PC does not have enough power, use a better PSU (Very Fatal)." });
            }
            _out.Add(new string[] { "End", "End" });

            return(_out);
        }