public Resource(IUrl url, bool caseSensitive) { this.Url = url; //this.LogStatus = "pending"; // "in progress" | "complete" | "not found" | "timeout" this.ResourceStatus = ResourceStatusEnum.Pending; // "in progress" | "complete" | "not found" | "timeout" this.CaseSensitive = caseSensitive; // Define properties that come from the XHR and its response headers. this.Content = ""; this.ContentType = ""; this.ContentLength = 0; this.Server = ""; this.CacheControl = ""; this.Date = null; this.ContentEncoding = ""; this.ContentLanguage = ""; this.Status = ""; this.LastModified = null; /* Properties that come from the resource's HTML */ this.Title = url.Title ?? ""; // May also get overwritten after HTML is downloaded and parsed this.Description = ""; /* Stats */ this.PercentageComplete = 0; this.Level = 0; this.OutLinks = 0; this.InLinks = 0; this.Error = ""; this.DateStart = null; this.DateEnd = null; }
private static IEnumerable <IUpload> SetUploaders(IUrl url, IReport report) { return(new List <IUpload> { new HttpWebRequest(url, report), new WebClient(url, report) }); }
public IResource AddItem(IUrl url) { if (url == null) { throw new ArgumentNullException("url"); } var matchingItem = FindItem(url); if (matchingItem != null) { // Update existing item's InLink count matchingItem.InLinks += 1; return(matchingItem); } else { // Add new item var newItem = ResourceFactory.Create(url, CaseSensitive); newItem.InLinks = this.ItemCount == 0 ? 0 : 1; this.Items.Add(newItem); return(newItem); } }
internal Task UpdateOrDeleteAsync(IUrl resource, Func <IFreeAgentApi, int, Task> action) { //TODO - safety stuff here?? var id = this.ExtractId(resource); return(this.Execute(c => action(c, id))); }
private static IEnumerable <IUpload> SetUploaders(IUrl url, IReport report) { return(new List <IUpload> { new CodecovUploader(url, report), new CodecovFallbackUploader(url, report) }); }
public TestAutoReconnector(ConnectionManager connectionManager, IDummy2 dummy, MessageUntara messageUntara, ILogger logger, IUrl url, IDataServer server) { _connectionManager = connectionManager; _dummy = dummy; _messageUntara = messageUntara; _logger = logger; _url = url; _server = server; }
public IResource FindItem(IUrl url) { var existing = this.Items //.Where(r => r.Url.IsEqualTo(url, this.CaseSensitive)) .Where(r => r.Url.IsEqualTo(url, this.CaseSensitive)) .FirstOrDefault(); return(existing); }
public UploadFacade(IContinuousIntegrationServer continuousIntegrationServer, IVersionControlSystem versionControlSystem, IYaml yaml, ICoverage coverage, IEnviornmentVariables enviornmentVariables, IUrl url, IUpload upload) { _continuousIntegrationServer = continuousIntegrationServer; _versionControlSystem = versionControlSystem; _yaml = yaml; _coverage = coverage; _enviornmentVariables = enviornmentVariables; _url = url; _upload = upload; }
public DummyImpl(IDataServer server, IUrl url, IBrowserProfile browserProfile, ILogger logger, IPeriscopeSiteOptions siteOptions, MessageProvider p1, MessageUntara messageSetter) { _server = server; _url = url; _browserProfile = browserProfile; _logger = logger; _siteOptions = siteOptions; _p1 = p1; _messageSetter = messageSetter; //_p2 = p2; }
public (IStatusCode, string) Download(IUrl str) { try { var json = wc.DownloadString(str.GetUrlContext().UrlStr); return(new StatusCodeImplementation(0), json); } catch (Exception e) { return(new StatusCodeImplementation(-1), null); } }
private static IEnumerable <IUpload> SetUploaders(IUrl url, IReport report, IDictionary <TerminalName, ITerminal> terminals) { var uploaders = new List <IUpload> { new HttpWebRequest(url, report) }; if (terminals[TerminalName.Powershell].Exits) { uploaders.Add(new WebClient(url, report)); } return(uploaders); }
private static IEnumerable <IUpload> SetUploaders(IUrl url, IReport report, IEnumerable <string> features) { var uploaders = new List <IUpload>(); if (!features.Any(f => string.Compare(f, "s3", StringComparison.OrdinalIgnoreCase) == 0)) { uploaders.Add(new CodecovUploader(url, report)); } uploaders.Add(new CodecovFallbackUploader(url, report)); return(uploaders); }
public string AddUrlNode(IUrl url, DateTime lastModifiedDate) { var hrefUrl = HttpUtility.UrlPathEncode(url.ToUrl(_domainUrl)); _xmlWriter.WriteStartElement("url"); _xmlWriter.WriteStartElement("loc"); _xmlWriter.WriteValue(HttpUtility.UrlPathEncode(url.ToUrl(_domainUrl))); _xmlWriter.WriteEndElement(); _xmlWriter.WriteEndElement(); _xmlWriter.Flush(); return(hrefUrl); }
internal Uri ExtractUrl(IUrl model) { if (model == null) { throw new FreeAgentException("Cannot extract URL from null model"); } if (model.Url == null || model.Url.Segments.Length <= 0) { throw new FreeAgentException("Model URL is null"); } return(model.Url); }
private bool checkEqual(IUrl ui, PlayControlViewModel vm) { if (ui is ILocalUrl) { return(ui.LocalPath == vm.Source.LocalSourcePath); } else if (ui is IRemoteUrl) { IRemoteUrl ru = ui as IRemoteUrl; return(ru.SourceIp == vm.Source.Storage.Ip && ru.SourcePort == vm.Source.Storage.Port && ru.BeginTime == vm.PlaySlider.BeginTime && ru.EndTime == vm.PlaySlider.EndTime); } return(false); }
public void GetPage(IUrl url, string pendingXPath = null) { Appeals++; _document = null; FileName = Converting(url.Get()); if (Urls.Contains(FileName) && File.Exists(FullPath)) { _document = Load(); if (_document != null) { return; } } Downloads++; _loader.GetPage(url, pendingXPath); }
public bool IsEqualTo(IUrl other, bool caseSensitive) { if (other == null) { return(false); } if (caseSensitive) { return(this.ToString() == other.ToString()); } else { return(this.ToString().ToLower() == other.ToString().ToLower()); } }
public void Initialize() { _eventLogApi = Apis.Get <IEventLog>(); _usersApi = Apis.Get <IUsers>(); _urlApi = Apis.Get <IUrl>(); _coreUrlsApi = Apis.Get <ICoreUrls>(); //hook the user created event to save SAML token data (from secure cookie if persist flag is set) for new users _usersApi.Events.AfterCreate += new UserAfterCreateEventHandler(Events_AfterUserCreate); //hook to create custom user authenticated event _usersApi.Events.AfterIdentify += new UserAfterIdentifyEventHandler(Events_AfterIdentify); //cleanup persistent storage when a user is deleted _usersApi.Events.AfterDelete += new UserAfterDeleteEventHandler(Events_AfterUserDelete); }
public bool IsUrlEnabled(string url) { bool result = true; if (url == null) { throw new ArgumentNullException("url"); } url = url.Trim().Replace('\\', '/'); if (EacFlightProvider.eacUrlToSectionMap.ContainsKey(url)) { VariantConfigurationSnapshot snapshotForCurrentUser = EacFlightUtility.GetSnapshotForCurrentUser(); IUrl @object = snapshotForCurrentUser.Eac.GetObject <IUrl>(EacFlightProvider.eacUrlToSectionMap[url]); result = @object.Enabled; } return(result); }
public void ProcessUrl(IUrl url) { var resource = this.ResourceLog.FindItem(url); try { if (resource.Status != "pending") { var downloader = this.DownloaderFactory.Create(); var parser = this.ContentParserFactory.Create(); } } catch (Exception e) { //resource.Status = xhr.status; //resource.LogStatus = xhr.statusText || "error"; } }
private void playFromUrl(IUrl ui) { if (ui is ITimePeriod) { ITimePeriod tp = ui as ITimePeriod; playCtrl.ViewModel.UpdateTimePeriod(tp.BeginTime, tp.EndTime); } //更新数据源。 VideoInfoManager.Instance.UpdateSource(ui); int sourceIndex = VideoInfoManager.Instance.SourceIndex; UrlAndIndex uai = new UrlAndIndex(ui, sourceIndex); new Thread(initPlay) { IsBackground = true, Name = "InitPlayVideos" }.Start(uai); }
public IResponse Handle(IRequest req) { IUrl url = req.Url; //url.Path == "/getTemperatures" if (url.Path == "/temperatures") //Return HTML-page temperatures { return(WebPagePlugin.CreateWebpageResponse("/temperatures")); } else //Return XML-file with temperatures { DateTime from = Convert.ToDateTime(url.Parameter["from"]); DateTime until = Convert.ToDateTime(url.Parameter["until"]); Response response = new Response(); response.StatusCode = 200; response.ContentType = "text/xml"; response.SetContent(GetTemperaturesContentXML(from, until)); return(response); } }
public static MvcForm BeginForm(this HtmlHelper htmlHelper, IUrl url, FormMethod method, IDictionary<string, object> htmlAttributes) { var builder = new TagBuilder("form"); builder.MergeAttributes(htmlAttributes); builder.MergeAttribute("action", url.ToString()); builder.MergeAttribute("method", HtmlHelper.GetFormMethodString(method), true); if (htmlHelper.ViewContext.ClientValidationEnabled) { builder.GenerateId("form0"); } htmlHelper.ViewContext.HttpContext.Response.Write(builder.ToString(TagRenderMode.StartTag)); var form = new MvcForm(htmlHelper.ViewContext); if (htmlHelper.ViewContext.ClientValidationEnabled) { // htmlHelper.ViewContext.FormContext.ClientValidationEnabled = true; htmlHelper.ViewContext.FormContext.FormId = builder.Attributes["id"]; } return form; }
public object CreateClass(IUrl url) { List <Dictionary <string, dynamic> > lst = new List <Dictionary <string, dynamic> >(); dynamic stuff = JsonConvert.DeserializeObject(url.GetUrlContext().Body); foreach (JObject jObj in stuff) { Dictionary <string, dynamic> dict = new Dictionary <string, dynamic>(); var rootProperties = jObj.Children().OfType <JProperty>().Select(p => p.Name).ToArray(); foreach (var property in rootProperties) { dict.Add(property, jObj.Property(property).Value.ToString()); } lst.Add(dict); } return((from l in lst select new DynamicDictionaryWrapper(l)).ToList()); }
private static IEnumerable <IUpload> SetUploaders(IUrl url, IReport report, IDictionary <TerminalName, ITerminal> terminals, bool disableS3) { var uploaders = new List <IUpload>(); if (disableS3) { uploaders.Add(new HttpWebRequestV2(url, report)); } else { uploaders.Add(new HttpWebRequestV4(url, report)); if (terminals[TerminalName.Powershell].Exists) { uploaders.Add(new WebClientV4(url, report, terminals[TerminalName.Powershell])); } } return(uploaders); }
private static SitemapNodeDefination MakeNode(SitemapNodeAttribute sitemapNodeAttr, IUrl url ) { var sitemapNode = new SitemapNodeDefination { IsHidden = sitemapNodeAttr.IsHidden, Text = () => sitemapNodeAttr.GetText(), Group = () => sitemapNodeAttr.GetGroup(), Icon = sitemapNodeAttr.Icon, Order = sitemapNodeAttr.Order, SiteMap = sitemapNodeAttr.SiteMap ?? GlobalSitemaps.DefaultSiteMap.Name, }; if (string.IsNullOrEmpty(sitemapNodeAttr.Name)) { sitemapNodeAttr.Name = Guid.NewGuid().ToString("N"); } sitemapNode.Name = sitemapNodeAttr.Name; sitemapNode.Url = url; return sitemapNode; }
private void playVideoInfos(PlayControlViewModel vm, IUrl ui) { if (checkEqual(ui, vm)) { foreach (VideoInfo vi in ui.VideoInfos) { if (!string.IsNullOrWhiteSpace(ui.LocalPath)) { string path = Path.Combine(ui.LocalPath, $"{vi.VideoId}_{vi.StreamId}"); if (!new DirectoryInfo(path).Exists) { Util.DialogUtil.ShowMessage(string.Format("未找到 \"{0}\" 视频!", vi.VideoName)); continue; } } vm.AddToPlay(vi.VideoId, vi.StreamId, vi.VideoName); } vm.IsPlaying = true; } }
public void UpdateSource(IUrl ui) { GlobalDataSource = null; SourceIndex++; DestoryProxy(); if (ui is ILocalUrl) { InfoManager = new LocalInfoProxy(ui.LocalPath); } else if (ui is IRemoteUrl) { InfoManager = new ImportInfoProxy(ui as IRemoteUrl); } else { Common.Log.Logger.Default.Trace("未找到正确的URL配置"); DialogUtil.ShowError("未找到正确的URL配置"); return; } InfoManager.LocalSourceInfoReceived += InfoManager_NodeUpdated; onDataSourceChanged(); }
public Manager(string PATH) { EndPointFactory factory1 = EndPointFactory.GetInstance(); IEndPoint endPoint = factory1.CreateEndPoint(); IUrl url = endPoint.GetUrl(PATH); IDownloadStrategy downloadStrategy = endPoint.GetDownloadStrategy(); (IStatusCode, string)result = endPoint.Download(downloadStrategy, url); if (result.Item1.GetStatusCode() != 0) { throw new RuntimeException("Failed to download: " + result.Item1.GetStatusCode()); } else { ClassCreatorFactory factory2 = ClassCreatorFactory.GetInstance(); IClassCreator classCreator = factory2.CreateClassCreator(); url.SetBody(result.Item2); IClassCreatorStrategy creatorStrategy = classCreator.GetClassCreatorStrategy(); var res = classCreator.CreateClass(creatorStrategy, url); } }
private void initSettings(string[] args) { if (args.Length > 0) { string url = args[0]; try { IUrl ui = null; try { ui = LocalUrl.Parse(url); } catch { } if (ui == null) { try { ui = RemoteUrl.Parse(url); } catch { } } if (ui != null) { return; } if (!tryToRemote(url)) { throw new ErrorMessageException("URL未能正确解析!"); } } catch (ErrorMessageException ae) { Common.Log.Logger.Default.Error(ae); Util.DialogUtil.ShowError(ae.Message); } } }
private void Play() { try { IDownloadInfo dInfo = _downloadInfo; IUrl ui = null; VideoInfo[] vInfos = new VideoInfo[] { new VideoInfo(dInfo.VideoId, dInfo.StreamId, dInfo.VideoName) }; if (!new DirectoryInfo(Path.Combine(dInfo.DownloadPath, $"{dInfo.VideoId}_{dInfo.StreamId}")).Exists) { //throw new FileNotFoundException("未找到该视频!"); vInfos = null; } ui = new RemoteUrl(dInfo.SourceIp, dInfo.SourcePort, dInfo.BeginTime, dInfo.EndTime, vInfos, dInfo.DownloadPath); string fileName = @"D:\Workspace\CCTV\CCTVReplay\CCTVReplay\bin\Debug\CCTVReplay.exe"; if (!new System.IO.FileInfo(fileName).Exists) { fileName = @"F:\CCTV\CCTVReplay\CCTVReplay\bin\Debug\CCTVReplay.exe"; } if (!new System.IO.FileInfo(fileName).Exists) { fileName = @"CCTVReplay.exe"; } if (!new FileInfo(fileName).Exists) { throw new FileNotFoundException("未找到播放软件!"); } Process.Start(fileName, ui.ToString()); Console.WriteLine("\n\n" + ui.ToString() + "\n\n"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void initPlay(object uaiObj) { UrlAndIndex uai = (UrlAndIndex)uaiObj; IUrl ui = uai.Url; int index = uai.Index; if (ui.VideoInfos == null || ui.VideoInfos.Length == 0) { return; } while (index == VideoInfoManager.Instance.SourceIndex) { PlayControlViewModel vm = getPlayCtrlModel(); if (vm.IsReadyToPlay()) { this.Dispatcher.BeginInvoke(new Action(() => { playVideoInfos(vm, ui); }), null); break; } Thread.Sleep(100); } }
public static MvcForm BeginForm(this HtmlHelper htmlHelper, IUrl url, FormMethod method) { return BeginForm(htmlHelper, url, method, new Dictionary<string, object>()); }
public ContentUrl() { mUrl = this._createUrl(); }
public static string Url(this HtmlHelper htmlHelper, IUrl url) { return url.ToString(); }