private static void Initialize() { IEnumerable <Type> types = Assembly.GetAssembly(typeof(TextModifier)).GetTypes().Where(type => type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(TextModifier))); foreach (Type type in types) { TextModifier textModifier = Activator.CreateInstance(type) as TextModifier; modifierTypes.Add(textModifier.ModificationMarker, type); availableMarkers.Add(textModifier.ModificationMarker); } isInitialized = true; }
/// <summary> /// Gets the current min bid for the auction /// </summary> /// <param name="auctionRef"></param> /// <returns></returns> public int CheckAuction(string auctionRef) { const string url = "https://auctions.godaddy.com/trpItemListing.aspx?miid={0}"; var data = Get(string.Format(url, auctionRef)); var minbid = TextModifier.TryParse_INT( GetSubString(HtmlDecode(data), "or more', ", ")").Trim().Replace(",", "").Replace("$", "")); //var end = GetEndDate(auctionRef); return(minbid); }
public List <TextModifier> ConvertToTextModifiers(TextModifiersFactory factory) { List <TextModifier> modifiers = new List <TextModifier>(); for (int i = 0; i < _markers.Count; i++) { TextModifier modifier = factory.ModifierByMarker(_markers[i]); if (modifier == null) { continue; } modifier.ApplyConfiguration(ConfigurationOfMarkerWithIndex(i)); modifier.TextToModify = TextWrappedByMarkerWithIndex(i); modifiers.Add(modifier); } return(modifiers); }
public override TextModifierScope CreateTextModifierScope(TextModifierScope parent, TextModifier textModifier) { return(new ConsoleTextModifierScope((ConsoleTextModifierScope)parent, (ConsoleTextModifier)textModifier)); }
public IQueryable <AuctionSearch> Search(string searchText) { const string searchString = "https://auctions.godaddy.com/trpSearchResults.aspx"; var auctions = new SortableBindingList <AuctionSearch>(); var doc = HtmlDocument(Post(searchString, "t=16&action=search&hidAdvSearch=ddlAdvKeyword:1|txtKeyword:" + searchText.Replace(" ", ",") + "|ddlCharacters:0|txtCharacters:|txtMinTraffic:|txtMaxTraffic:|txtMinDomainAge:|txtMaxDomainAge:|txtMinPrice:|txtMaxPrice:|ddlCategories:0|chkAddBuyNow:false|chkAddFeatured:false|chkAddDash:true|chkAddDigit:true|chkAddWeb:false|chkAddAppr:false|chkAddInv:false|chkAddReseller:false|ddlPattern1:|ddlPattern2:|ddlPattern3:|ddlPattern4:|chkSaleOffer:false|chkSalePublic:true|chkSaleExpired:true|chkSaleCloseouts:false|chkSaleUsed:false|chkSaleBuyNow:false|chkSaleDC:false|chkAddOnSale:false|ddlAdvBids:0|txtBids:|txtAuctionID:|ddlDateOffset:&rtr=2&baid=-1&searchDir=1&rnd=0.899348703911528&jnkRjrZ=6dd022d")); if (QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1") != null) { foreach (var node in QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1")) { if (QuerySelector(node, "span.OneLinkNoTx") != null && QuerySelector(node, "td:nth-child(5)") != null) { AuctionSearch auction = GenerateAuctionSearch(); auction.DomainName = HtmlDecode(QuerySelector(node, "span.OneLinkNoTx").InnerText); Console.WriteLine(auction.DomainName); auction.BidCount = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5)").FirstChild.InnerHtml.Replace(" ", ""))); auction.Traffic = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td").InnerText.Replace(" ", ""))); auction.Valuation = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(2)").InnerText.Replace(" ", ""))); auction.Price = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(3)").InnerText).Replace("$", "").Replace(",", "").Replace("C", "")); try { if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div") != null) { if (HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText).Contains("Buy Now for")) { auction.BuyItNow = TextModifier.TryParse_INT(Regex.Split(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText), "Buy Now for")[1].Trim().Replace(",", "").Replace("$", "")); } } else { auction.BuyItNow = 0; } } catch (Exception) { auction.BuyItNow = 0; } if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null && HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $")) { auction.MinBid = TextModifier.TryParse_INT(GetSubString(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", "")); } if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null && !HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $")) { auction.EstimateEndDate = GenerateEstimateEnd(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)")); } if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4)") != null && HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml).Contains("Bid $")) { auction.MinBid = TextModifier.TryParse_INT(GetSubString(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", "")); } if (QuerySelector(node, "td > div > span") != null) { foreach (var item in GetSubStrings(QuerySelector(node, "td > div > span").InnerHtml, "'Offer $", " or more")) { auction.MinOffer = TextModifier.TryParse_INT(item.Replace(",", "")); } } auction.EndDate = GetPacificTime; foreach (var item in GetSubStrings(node.InnerHtml, "ShowAuctionDetails('", "',")) { auction.AuctionRef = item; break; } //AppSettings.Instance.AllAuctions.Add(auction); if (auction.MinBid > 0) { auctions.Add(auction); } } } } return(auctions.AsQueryable()); }
public override TextModifierScope CreateTextModifierScope(TextModifierScope parent, TextModifier textModifier) { return(new UnityTextModifierScope((UnityTextModifierScope)parent, (UnityTextModifier)(textModifier ?? this.CreateDefaultTextModifier()))); }