public BrandLogoDownloadTask(CarBrand carBrand)
        {
            mFilePath = Path.Combine(BASE_FILE_PATH, BRAND_DIR, PINYIN_DIR); //carBrand.Name);
            mFileName = Path.Combine(mFilePath, PinYinConverter.Get(carBrand.Name) + IMAGE_POSTFIX);
            carBrand.LogoPath = Path.Combine(Environment.CurrentDirectory , mFileName);
            initFile();

            mUrl = carBrand.LogoUrl;
        }
예제 #2
0
        public void Run()
        {
            HtmlDocument htmlDocument = new HtmlWeb().Load(WebConstants.BASE_URL + WebConstants.PHOTO_URL);
            HtmlNodeCollection brandNodes = htmlDocument.DocumentNode.SelectNodes(WebConstants.BRAND_NODE);
            if (brandNodes != null)
            {
                foreach (HtmlNode tempNode in brandNodes)
                {
                    HtmlNode brandNode = HtmlNode.CreateNode(tempNode.OuterHtml);
                    string brandUrl = brandNode.SelectSingleNode(WebConstants.LINK_HREF).Attributes[WebConstants.HREF].Value;
                    char brandAlpha = brandNode.SelectSingleNode(WebConstants.BRAND_ALPHA).InnerText.ToCharArray()[0];
                    string brandNamePostFix = brandNode.SelectSingleNode(WebConstants.BRAND_NAME_POSTFIX).InnerText;
                    string brandName = brandNode.InnerText;
                    brandName = brandName.Substring(1, brandName.Length - brandNamePostFix.Length - 1);

                    CarBrand carBrand = new CarBrand(brandUrl);
                    carBrand.Alpha = brandAlpha;
                    carBrand.Name = brandName;
                    mCarBrandList.Add(carBrand);
                }
            }

            runBrandTasks();
        }
예제 #3
0
 public WebBrandTask(CarBrand carBrand)
 {
     mCarBrand = carBrand;
 }
예제 #4
0
 public CarFactory(CarBrand carBrand)
 {
     CarBrand    = carBrand;
     CarTypeList = new List <CarType>();
 }
예제 #5
0
 public CarFactory(CarBrand carBrand)
 {
     CarBrand = carBrand;
     CarTypeList = new List<CarType>();
 }