示例#1
0
文件: CPU.cs 项目: buzzon/PC-Builder
 public IComponent Constructor(OptionCollection options, dynamic modelParserResult)
 {
     return(new CPU
     {
         Brand = Brand,
         Model = modelParserResult.Model,
         Benchmark = Benchmark,
         Price = Price,
         Url = Url
     });
 }
示例#2
0
文件: HDD.cs 项目: buzzon/PC-Builder
        public IComponent Constructor(OptionCollection options, dynamic modelParserResult)
        {
            Formfactor formfactor = Server.FindOrAdd(modelParserResult.Formfactor, options.Formfactors, new Formfactor());

            return(new HDD
            {
                Brand = Brand,
                Model = modelParserResult.Model,
                Benchmark = Benchmark,
                Price = Price,
                Url = Url,
                Formfactor = formfactor.Id,
                Capacity = modelParserResult.Capacity
            });
        }
示例#3
0
文件: GPU.cs 项目: buzzon/PC-Builder
        public IComplexComponent SpecificationParser(string specification, OptionCollection options)
        {
            string memory = Regex.Match(specification,
                                        "Объем памяти</td><td class=\"gr\\d\">(.+)</td></tr>").Groups[1].Value;

            if (memory.Length == 0)
            {
                return(null);
            }
            int index = memory.IndexOf('/');

            if (index > 0)
            {
                memory = memory.Remove(index);
            }
            Memory = int.Parse(memory);
            return(this);
        }
示例#4
0
文件: CPU.cs 项目: buzzon/PC-Builder
        public IComplexComponent SpecificationParser(string specification, OptionCollection options)
        {
            string cores = Regex.Match(specification,
                                       "Количество ядер</td><td class=\"gr\\d\">(.+)</td></tr>").Groups[1].Value;

            Cores = int.Parse(cores);

            string threads = Regex.Match(specification,
                                         "Количество потоков</td><td class=\"gr\\d\">(.+)</td></tr>").Groups[1].Value;

            if (threads.Length == 0)
            {
                Threads = int.Parse(cores) * 2;
            }
            else
            {
                Threads = int.Parse(threads);
            }

            string socketTitle = Regex.Match(specification,
                                             "Разъем</td><td class=\"gr\\d\">(.+)</td></tr>").Groups[1].Value;
            int removeIndex = socketTitle.IndexOf('-');

            if (removeIndex >= 0)
            {
                socketTitle = socketTitle.Remove(removeIndex);
            }
            Socket socket = Server.FindOrAdd(socketTitle, options.Sockets, new Socket());

            Socket = socket.Id;

            string frequency = Regex.Match(specification,
                                           "Частота, МГц</td><td class=\"gr\\d\">([^ <]+).*</td></tr>").Groups[1].Value;

            Frequency = int.Parse(frequency);
            return(this);
        }