/// <summary> /// Log an error about retrieveing the new stock values. /// </summary> /// <param name="website">The website<see cref="IWebsite"/>.</param> public static void HtmlStockCheckError(IWebsite website) { string log = $"Error checking html for stock at: {website.GetType().Name}"; Console.WriteLine(log); Mailer.SendLogThreaded(log); }
private void dgvWebsites_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { if (!IsAddingNewItem && !IsCellValueChanged) { return; } int colIndex = e.ColumnIndex; int rowIndex = e.RowIndex; IWebsite website = websites[rowIndex]; ValidationResult vr = ContextMenuEvent.Invoke(EventType.RowValidating, new ContextMenuEventArgs() { RowIndex = rowIndex, ColumnIndex = colIndex, Website = website }); if (!vr.IsSuccessfull) { ShowErrorMessage(vr.Message, "Error!"); e.Cancel = true; } else { IsAddingNewItem = false; IsCellValueChanged = false; } }
public ModsPageView(IParkitect parkitect, ILogger log, IPresenter parent, IQueueableTaskManager queueableTaskManager, IWebsite website) : base(parkitect, website, log, AssetType.Mod, parent, "Mods") { _parkitect = parkitect; _queueableTaskManager = queueableTaskManager; _website = website; }
public FileManagerService(IWebsite website, IFileStorage fileStorage, IStorageItemRepository storageItemRepository, ITransactionManager transactionManager) { this._fileStorage = fileStorage; this._website = website; this._transactionManager = transactionManager; this._storageItemRepository = storageItemRepository; }
public MembershipService(IWebsite website, IMemberDao memberDao, IRoleDao roleDao, ITransactionManager transactionManager) { this._website = website; this._memberDao = memberDao; this._roleDao = roleDao; this._transactionManager = transactionManager; }
public RemoteAssetRepository(ILogger logger, IWebsite website, INexusWebClientFactory webClientFactory) { _logger = logger; _website = website; _webClientFactory = webClientFactory; }
public static void Download(IWebsite website) { try { using (var client = new WebClient()) { _website = website; var downloadUrl = client.DownloadString(website.Url); var scraper = new Scraper(); website.ScrapeCriteriaPart = scraper.AddScrapeCriteriaPart(website.AppSettings["ScrapeCriteriaPart"], RegexOptions.Singleline); website.ScrapeCriteria = scraper.AddScrapeCriteria(downloadUrl, website.AppSettings["ScrapeCriteria"], RegexOptions.Singleline, website.ScrapeCriteriaPart); _scrapedElements = scraper.Scrape(website.ScrapeCriteria); ScrapeFileManager.AppendToFile(_scrapedElements); } } catch (Exception e) { Logger.Error(e.Message); throw; } }
public ImageService(IWebsite website, IImageStorage imageStorage, IImageRepository imageRepository, ITransactionManager transactionManager) { this._website = website; this._imageStorage = imageStorage; this._imageRepository = imageRepository; this._transactionManager = transactionManager; }
public CrashReporterFactory(INexusWebClientFactory webClientFactory, IWebsite website, IParkitect parkitect, ILogger log) { _website = website; _parkitect = parkitect; _webClientFactory = webClientFactory; _log = log; }
public CheckForUpdatesTask(IParkitect parkitect, IWebsite website, ILogger log, IQueueableTaskManager queueableTaskManager) : base("Check for updates") { _parkitect = parkitect; _website = website; _log = log; _queueableTaskManager = queueableTaskManager; StatusDescription = "Check for updates."; }
public void CheckWebsite(object obj) { IWebsite website = (IWebsite)obj; website.IsOnline = WebsiteChecker.CheckURL(website.URL); website.ChecksCount++; OnDataUpdate?.Invoke(); }
public AuthManager(IWebsite website, ISettingsRepository <AuthSettings> authSettingsRepository, ICacheManager cacheManager, ILogger log) { _website = website; _authSettingsRepository = authSettingsRepository; _cacheManager = cacheManager; _log = log; }
public AuthManager(IWebsite website, ISettingsRepository<AuthSettings> authSettingsRepository, ICacheManager cacheManager, ILogger log) { _website = website; _authSettingsRepository = authSettingsRepository; _cacheManager = cacheManager; _log = log; }
public LocalAssetRepository(IParkitect parkitect, IWebsite website, ILogger log, IAssetMetadataStorage assetMetadataStorage, IAssetCachedDataStorage assetCachedDataStorage) { _parkitect = parkitect; _website = website; _log = log; _assetMetadataStorage = assetMetadataStorage; _assetCachedDataStorage = assetCachedDataStorage; }
public InstallAssetTask(IParkitect parkitect, IWebsite website, IRemoteAssetRepository remoteAssetRepository, IQueueableTaskManager queueableTaskManager) : base("Install asset") { _parkitect = parkitect; _website = website; _remoteAssetRepository = remoteAssetRepository; _queueableTaskManager = queueableTaskManager; StatusDescription = "Install an asset."; }
public HTTPServer(IParser parser, IWebsite website, IError error, IResponse responseGenrate, IDispatch dispatch, IRequest request) { _parser = parser; _website = website; _error = error; _responseGenrate = responseGenrate; _dispatch = dispatch; _request = request; }
public UpdateModTask(IModAsset mod, IParkitect parkitect, IQueueableTaskManager queueableTaskManager, IWebsite website) : base($"Update mod {mod?.Name}") { if (mod == null) throw new ArgumentNullException(nameof(mod)); _mod = mod; _parkitect = parkitect; _queueableTaskManager = queueableTaskManager; _website = website; StatusDescription = $"Update mod {mod.Name}"; }
/// <summary> /// Return empty stock values. /// </summary> /// <param name="website">The website<see cref="IWebsite"/>.</param> /// <returns>The <see cref="Stock"/>.</returns> public static Stock GetEmptyStock(IWebsite website) { Dictionary <Videocard, int> values = new Dictionary <Videocard, int>(); foreach (Videocard card in Enum.GetValues(typeof(Videocard))) { values[card] = 0; } return(new Stock(website, values)); }
public AddControlViewModel(IWebsite website, IControl control, IControl parentControl, string location) : base(website) { this._control = control; this._parentControl = parentControl; this._location = location; if (string.IsNullOrEmpty(this._location)) { this._location = parentControl.Location; } }
public PageGetter( IWebClientWrapper client, IHtmlDocumentWrapper document, IWebsite website, ILog log) { _client = client; _document = document; _website = website; _log = log; _urls = new List <string>(); }
/// <summary> /// Gets all the members in the system /// </summary> public IList<Member> GetAllMembers(IWebsite website) { var db = new PetaPoco.Membership.Database("Portal"); List<Member> members = db.Fetch<Member, Profile, Member>(new MemberProfileRelator().MapIt, @"Select * From Membership.Members m Inner Join Membership.MemberWebsites w On m.MemberId = w.MemberId Inner Join Membership.Profiles p On m.ProfileId = p.ProfileId Where WebsiteId = @WebsiteId Order By Username", new { WebsiteId = website.Id }); return members; }
//---------- public void Run() { Console.OutputEncoding = System.Text.Encoding.UTF8; ( BookingDatabase accomodationData, TripAdvisorDatabase tripsData, ShutterStockDatabase photosData, OysterDatabase reviewData ) = Init.Init.Run(); //---------- //YOUR CODE - set up everything travelAgencies.Add(new PolandTravel(tripsData, reviewData, accomodationData, photosData)); travelAgencies.Add(new FranceTravel(tripsData, reviewData, accomodationData, photosData)); travelAgencies.Add(new ItalyTravel(tripsData, reviewData, accomodationData, photosData)); adAgencies.Add(new GraphicalAgency(3, 2)); adAgencies.Add(new ReviewAgency(3, 2)); offerWebsite = new Website(WebsiteTemporaryOfferCount, WebsitePermanentOfferCount, travelAgencies, adAgencies); //---------- while (true) { Console.Clear(); //---------- //YOUR CODE - run // nie koniecznie potrzebne ale czemu nie niech będzie for (int i = 0; i < 5; i++) { offerWebsite.UpdateOfferList(); } //---------- //uncomment Console.WriteLine("\n\n=======================FIRST PRESENT======================"); offerWebsite.Present(); Console.WriteLine("\n\n=======================SECOND PRESENT======================"); offerWebsite.Present(); Console.WriteLine("\n\n=======================THIRD PRESENT======================"); offerWebsite.Present(); if (HandleInput()) { break; } } }
public Ripper(IWebsite iwebsite_1) { this.ActiveThreads = (IList <Thread>) new List <Thread>(); this.History = MySettings.Instance.LoadHistoryFile(iwebsite_1.HistoryFilePath); this.FailedPosts = (IList <IFileToDownloadFailed>)Enumerable.ToList <IFileToDownloadFailed>(Enumerable.Cast <IFileToDownloadFailed>((IEnumerable)MySettings.Instance.LoadHistoryFile(iwebsite_1.FailedFilePath))); this.PostsFound = new System.Collections.Generic.Queue <IFileToDownload>((IEnumerable <IFileToDownload>)MySettings.Instance.LoadHistoryFile(iwebsite_1.PendingFilePath)); this.string_0 = iwebsite_1.LocalDir; this.Website = iwebsite_1; this.MaxThreads = 15; this.UpdateStatusTotalPosts(this.History.Count); this.UpdateStatusPendingPosts(this.PostsFound.Count); this.UpdateStatusFailedPosts(this.FailedPosts.Count); }
public UpdateModTask(IModAsset mod, IParkitect parkitect, IQueueableTaskManager queueableTaskManager, IWebsite website) : base($"Update mod {mod?.Name}") { if (mod == null) { throw new ArgumentNullException(nameof(mod)); } _mod = mod; _parkitect = parkitect; _queueableTaskManager = queueableTaskManager; _website = website; StatusDescription = $"Update mod {mod.Name}"; }
public PageChecker( ILinkDictionary dictionary, IWebClientWrapper client, IHtmlDocumentWrapper document, ILog logger, IWebsite website) { _dictionary = dictionary; _client = client; _document = document; _logger = logger; _website = website; }
public ValidationResult ValidateAdd(IWebsite website) { ValidationResult vr = ValidateValues(website); if (!vr.IsSuccessfull) { return(vr); } AddWebsite(website); SaveToXML(); return(vr); }
public ValidationResult ValidateEdit(int index, IWebsite website) { ValidationResult vr = ValidateValues(website); if (!vr.IsSuccessfull) { return(vr); } EditWebsite(index, website); SaveToXML(); return(vr); }
/// <summary> /// The GetStock. /// </summary> /// <param name="website">The website<see cref="IWebsite"/>.</param> private void GetStock(IWebsite website) { Stock stock = website.GetStock(); if (CheckStockChange(website, stock) && Constants.GetUseMongoDb()) { Mongo.InsertStock(stock); } if (this.verboseMode) { Printer.PrintStock(stock); } this.stockRecords[website] = stock; }
public AssetsPageView(IParkitect parkitect, IWebsite website, ILogger log, AssetType type, IPresenter parent, string displayName) : base(log, displayName) { if (!(parent is MainView)) throw new ArgumentException("parent must be MainView", nameof(parent)); _parkitect = parkitect; _website = website; _log = log; _type = type; MainView = (MainView) parent; parkitect.Assets.AssetAdded += Assets_AssetAdded; parkitect.Assets.AssetRemoved += Assets_AssetRemoved; GetRequiredMods(); }
/// <summary> /// The CheckStockChange. /// </summary> /// <param name="website">The website<see cref="IWebsite"/>.</param> /// <param name="stock">The stock<see cref="Stock"/>.</param> /// <returns>The <see cref="bool"/>.</returns> private bool CheckStockChange(IWebsite website, Stock stock) { bool ret = false; foreach (Videocard videocard in Enum.GetValues(typeof(Videocard))) { if (this.stockRecords[website] != null && this.stockRecords[website].Values[videocard] < stock.Values[videocard]) { Mailer.ProductUrl = stock.Website.GetProductUrl(videocard); Mailer.SendToast(stock.Website.GetType().Name, stock.Website.GetType().Name + " has a " + Enum.GetName(typeof(Videocard), videocard)); Mailer.SendNotificationsThreaded(stock, videocard); Logger.StockUpdate(stock, videocard); ret = true; } } return(ret); }
//string scheme, string host, string path, string name) public StorageItem(StorageItemType type, IWebsite website, Uri url) { this._website = website; this._scheme = url.Scheme; this._host = url.Host + "/" + url.Segments[1]; string localPath = url.LocalPath; if (localPath.EndsWith("/")) { localPath = localPath.Substring(0, localPath.Length - 1); } var segments = localPath.Split('/'); this._name = segments[segments.Length - 1]; for (int i = 2; i < segments.Length - 1; i++) { this._path += segments[i] + "/"; } if (type == StorageItemType.Folder) { //this._name = this._name.Substring(0, this._name.Length - 1); } //return new Folder(website, uri.Scheme, host, path, fileName.Substring(0, fileName.Length - 1)); //string fileName = uri.Segments[uri.Segments.Length - 1]; //for (int i = 0; i < 2; i++) { host += uri.Segments[i]; } //for (int i = 2; i < uri.Segments.Length - 1; i++) { path += uri.Segments[i]; } //this._path = path; //this._name = name; if (!string.IsNullOrEmpty(this._path)) { string[] parents = this._path.Split('/'); string parentPath = string.Empty; if (parents.Length >= 2) { string parentFileName = parents[parents.Length - 2]; for (int i = 0; i < parents.Length - 2; i++) { parentPath += parents[i]; } this.Parent = new Folder(website, new Uri(this._scheme + "://" + this._host + this._path)); } } }
private void RunFlatWebsiteScraper(string appSettings, IWebsite iWebsite) { _customAppSettings = NameValueCollectionSetter.GetCustomNameValueCollection(appSettings); if (iWebsite is AruodasLt) { iWebsite = new AruodasLtBuilder().CreateFromAppSettings(_customAppSettings); } if (iWebsite is DomoPliusLt) { iWebsite = new DomoPliusLtBuilder().CreateFromAppSettings(_customAppSettings); } Downloader.Download(iWebsite); iWebsite.MailBody = Downloader.TransformListToString(); SendEmail(iWebsite.MailSubject, iWebsite.MailBody); }
public AssetsPageView(IParkitect parkitect, IWebsite website, ILogger log, AssetType type, IPresenter parent, string displayName) : base(log, displayName) { if (!(parent is MainView)) { throw new ArgumentException("parent must be MainView", nameof(parent)); } _parkitect = parkitect; _website = website; _log = log; _type = type; MainView = (MainView)parent; parkitect.Assets.AssetAdded += Assets_AssetAdded; parkitect.Assets.AssetRemoved += Assets_AssetRemoved; GetRequiredMods(); }
/// <summary> /// Gets a specific member by there id /// </summary> /// <param name="website">the website this member should belong to</param> /// <param name="member">the id of the member</param> public Member GetMemberById(IWebsite website, int memberId) { var db = new PetaPoco.Membership.Database("Portal"); var members = db.Fetch<Member, Profile, Member>(new MemberProfileRelator().MapIt, @"Select * From Membership.Members m Inner Join Membership.MemberWebsites w On m.MemberId = w.MemberId Inner Join Membership.Profiles p On m.ProfileId = p.ProfileId Where m.MemberId = @MemberId And WebsiteId = @WebsiteId", new { WebsiteId = website.Id, MemberId = memberId }); Member member = null; if (members.Count > 0) { member = members.First(); member.Roles = db.Fetch<Role>("Select * From Membership.Roles r Inner Join Membership.MemberRoles mr On r.RoleId = mr.RoleId Where mr.MemberId = @MemberId", new { MemberId = memberId }); } return member; }
private ValidationResult ValidateValues(IWebsite website) { ValidationResult vr = new ValidationResult(); if (String.IsNullOrWhiteSpace(website.Name) || website.Name.Length < 3) { vr.IsSuccessfull = false; vr.Message = "Name is too short!!!"; return(vr); } Uri uriResult; bool result = Uri.TryCreate(website.URL, UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps); if (!result) { vr.IsSuccessfull = false; vr.Message = @"URL format: protocol://name.domain! Protocols are - (http|https)."; return(vr); } /*string regexURL = @"^((http|ftp|https)://)?([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?$"; * if (String.IsNullOrWhiteSpace(website.URL) || !Regex.IsMatch(website.URL, regexURL)) * { * vr.IsSuccessfull = false; * vr.Message = @"URL format: protocol://name.domain! Protocols are - (http|ftp|https)."; * return vr; * }*/ if (website.CheckInterval < 10) { vr.IsSuccessfull = false; vr.Message = @"Interval should be greater than 10 (seconds)!"; return(vr); } vr.IsSuccessfull = true; return(vr); }
public static Task Start(IWebsite w, CancellationToken ct) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type Controller.Class2 class2 = new Controller.Class2(); Controller.cancellationToken_0 = ct; Ripper ripper = new Ripper(w); // ISSUE: reference to a compiler-generated field class2.itrPlugin_0 = PluginLoader.GetPlugin(w.PluginInName); // ISSUE: reference to a compiler-generated field if (class2.itrPlugin_0 == null) { return((Task)null); } // ISSUE: reference to a compiler-generated field class2.itrPlugin_0.NewInstance((IRipper)ripper, MySettings.Instance.LoadPluginSettingsFile(w.PluginSettingsFilePath)); // ISSUE: reference to a compiler-generated field Controller.itrPlugin_0 = class2.itrPlugin_0; // ISSUE: reference to a compiler-generated method Controller.task_0 = Task.Factory.StartNew(new Action(class2.method_0), Controller.cancellationToken_0); return(Controller.task_0); }
public SavegamesPageView(IParkitect parkitect, IWebsite website, ILogger log, IPresenter parent) : base(parkitect, website, log, AssetType.Savegame, parent, "Savegames") { }
public PropertiesPageViewModel(IWebsite website, IList<IProperty> properties) : base(website) { this.Properties = properties.Select(o => new PropertyViewModel(o)).ToList(); }
public CmsPagesViewModel(IWebsite website, IList<IPage> pages) : base(website) { this._pages = pages.Select(o => new PageViewModel(o)).ToList(); }
/// <summary> /// Initializes a new instance of the <see cref="ParkitectNexusAPI" /> class. /// </summary> /// <param name="website">The website.</param> /// <param name="webClientFactory">The web client factory.</param> /// <param name="log"></param> /// <exception cref="ArgumentNullException">website or webClientFactory is null.</exception> public ParkitectNexusAPI(IWebsite website, INexusWebClientFactory webClientFactory, ILogger log) { _website = website; _webClientFactory = webClientFactory; _log = log; }
public UpdateManager(IWebsite website, INexusWebClientFactory webClientFactory, ILogger log) { _website = website; _webClientFactory = webClientFactory; _log = log; }
public PropertiesPageViewModel(IWebsite website, IProperty property) : base(website) { this.Property = new PropertyViewModel(property); }
public MenuPageView(IParkitect parkitect, ILogger log, IWebsite website, App app) : base(log, "Menu") { _parkitect = parkitect; _website = website; }
public TemplatesPageViewModel(IWebsite website, IList<Template> templates) : base(website) { this._templates = templates; }
public CmsPageViewModel(IWebsite website, IPage page) : base(website) { this._page = new Portal.Web.Areas.CMS.Models.PageViewModel(page); }
public CmsPageViewModel(IWebsite website, IList<Template> templates) : base(website) { this._page = new Portal.Web.Areas.CMS.Models.PageViewModel(templates); this._templates = templates; }
public CmsPageViewModel(IWebsite website, PageViewModel pageViewModel, IList<Template> templates) : base(website) { this._page = pageViewModel; pageViewModel.AddTemplates(templates); }
public File(IWebsite website, Uri url) : base(StorageItemType.File, website, url) { }
/// <summary> /// Creates a view model to render a list of members onto the page /// </summary> /// <param name="website">the website portal we are in</param> /// <param name="members">the members to render on the page</param> public MembershipPageViewModel(IWebsite website, IList<Member> members, IList<Role> roles) : base(website) { this.Members = members.Select(o => new MemberViewModel(o, roles)).ToList(); }
public void Add(IWebsite newWebsite) { websites.Add(newWebsite); }
public AssetCachedDataStorage(IWebsite website, ILogger log) { _log = log; _website = website; }
public WebsiteLogic(IWebsite websiteRepo) { _websiteRepo = websiteRepo; }
/// <summary> /// Creates a new view model to view / edit / create a member /// </summary> /// <param name="website">the website portal we are in</param> /// <param name="member">the member to view / edit or create</param> public MembershipPageViewModel(IWebsite website, Member member, IList<Role> roles) : base(website) { this.Member = new MemberViewModel(member, roles); }