Пример #1
0
 public IComponent Constructor(OptionCollection options, dynamic modelParserResult)
 {
     return(new CPU
     {
         Brand = Brand,
         Model = modelParserResult.Model,
         Benchmark = Benchmark,
         Price = Price,
         Url = Url
     });
 }
Пример #2
0
        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
        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
        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);
        }