public void OpenConfirmationWindow(URLType eURLType, string androidURLWeblink, string appleURLWeblink, MultiLanguageText confirmationDescription, SubSceneManager previousScene = null, ObjectTransitionAnimation previousNotePage = null) { if (m_rConfirmationWindowDisplay != null) { // Hide whatever notes are currently active (if applicable) if (ObjectTransitionAnimation.CurrentlyActive != null) { ObjectTransitionAnimation.CurrentlyActive.Disappear(false); } // Reveal Confirmation Window & Show URL Confirmation Description m_rConfirmationWindowDisplay.Reveal(); if (m_rTextDisplay != null && confirmationDescription != null) { confirmationDescription.ApplyEffects(m_rTextDisplay); } // Show Background Vignette VignetteManager.TransitionVignette(m_oVignetteInfo); // Assign URL variables as provided. m_eType = eURLType; androidURL = androidURLWeblink; URL = appleURLWeblink; m_rPreviousScene = previousScene; m_rPreviousNotePage = previousNotePage; if (m_rDoNotOpenURLButton != null) { m_rDoNotOpenURLButton.PreviousScene = previousScene; m_rDoNotOpenURLButton.PreviousNotePage = previousNotePage; } } }
public Boolean IsTopicUrl(String sURL, out String topicId) { HelpQuery helpQuery; URLType urlType = UrlInfo(sURL, out helpQuery); topicId = helpQuery.AssetId; return(urlType == URLType.Topic); }
private void Init(string pagePath, string pageClassName, string rexStr, string mime, bool enableScript, bool enableCache, string contentType, int age) { _pagePath = pagePath; _enableScript = enableScript; _enableCache = enableCache; if (string.IsNullOrEmpty(pageClassName)) { _pageClassName = "Xy.Web,Xy.Web.Page.EmptyPage"; } else { _pageClassName = pageClassName; } Runtime.Web.PageClassLibrary.Add(_pageClassName); _age = new TimeSpan(age / 60, age % 60, 0); switch (contentType) { case "MainContent": _contentType = URLType.MainContent; break; case "Prohibit": _contentType = URLType.Prohibit; break; case "ResourceFile": default: _contentType = URLType.ResourceFile; break; } if (_enableScript) { _contentType = URLType.MainContent; } if (!string.IsNullOrEmpty(rexStr)) { //_regex = new Regex(rexStr, RegexOptions.Compiled | RegexOptions.IgnoreCase); _regex = new Regex(rexStr, RegexOptions.Compiled); List <string> _groupsName = new List <string>(_regex.GetGroupNames()); for (int i = _groupsName.Count - 1; i >= 0; i--) { if (char.IsDigit(_groupsName[i], 0)) { _groupsName.RemoveAt(i); } } _URLGroupsName = _groupsName.ToArray(); } if (!string.IsNullOrEmpty(mime)) { _mime = mime; } }
public URL(URLType type, string pathOrContent) { Type = type; if (type == URLType.Path) { Path = pathOrContent; } else if (type == URLType.Resource) { Content = pathOrContent; } }
private List <DownloadState> GetAllDownloadsFor(URLType uRLType, DownloadData data) { List <DownloadState> list = new List <DownloadState>(); foreach (DownloadState state in data) { if (state.URLType == uRLType) { list.Add(state); } } return(list); }
public string GetURL(URLType type) { switch (type) { case URLType.URL: return(ReturnLink(URL)); case URLType.ThumbnailURL: return(ReturnLink(ThumbnailURL)); case URLType.DeletionURL: return(ReturnLink(DeletionURL)); } return(null); }
public static URLType SupportedProtocol(string url) { Guard.NullArgument(url, "url"); URLType urlType = URLType.Undefined; if (Utils.StartsWith(url, "http:", true) || Utils.StartsWith(url, "https:", true)) { urlType = URLType.Web; } else if (Utils.StartsWith(url, "file:", true)) { urlType = URLType.File; } return(urlType); }
public static bool URLExists(URLType type, int name) { var r = false; var url = Parser.AdminUrl + "/images/"; switch (type) { case URLType.Icon: url += "icons/" + name + ".png"; break; case URLType.Page: url += "pages/" + name + ".jpg"; break; default: break; } WebRequest webRequest = WebRequest.Create(url); webRequest.Timeout = 1200; // miliseconds webRequest.Method = "HEAD"; HttpWebResponse response = null; try { response = (HttpWebResponse)webRequest.GetResponse(); r = true; } catch { } finally { if (response != null) { response.Close(); } } return(r); }
public static string URLBuilder(URLType type, int name) { var url = Parser.AdminUrl + "/images/"; switch (type) { case URLType.Icon: url += "icons/" + name + ".png"; break; case URLType.Page: url += "pages/" + name + ".jpg"; break; default: break; } return(url); }
public string GetUrlTypeName(URLType type) { switch (type) { case URLType.BBS: return("论坛"); case URLType.Blog: return("博客"); case URLType.MicroBlog: return("微博"); case URLType.News: return("新闻"); case URLType.Index: return("综合"); default: return("其它"); } }
public AccessPoint() { URLType = UDDI.API.URLType.Http; }
private void rtbCustomUploaderDeletionURL_Enter(object sender, EventArgs e) { customUploaderURLType = URLType.DeletionURL; }
private void rtbCustomUploaderThumbnailURL_Enter(object sender, EventArgs e) { customUploaderURLType = URLType.ThumbnailURL; }
public override DownloadData GetProcessedData(ProcessedDataPackage state) { DownloadDumpFilesInfo ddfi = new DownloadDumpFilesInfo(state); Stream file = ddfi.Open(FileAccess.Read); DownloadData processedData = new DownloadData(); if (file == null) { return(processedData); } StreamReader source = new StreamReader(file); String buffer = source.ReadToEnd(); source.Close(); source.Dispose(); if (buffer == null) { return(null); } processedData.DownloadDataDumpFilename = ddfi.GetFilename(); DownloadState downloadState = null; MatchCollection matchs = null; matchs = download_Dump_Pattern.Matches(buffer); Match match = null; URLType type = URLType.Unknown; processedData.TotalFiles = matchs.Count; for (int i = 0; i < matchs.Count; i++) { match = matchs[i]; try { downloadState = new DownloadState(); downloadState.FileGUID = match.Groups[1].ToString(); downloadState.ConnectionStartTime = Math.Max(-1, long.Parse(match.Groups[2].ToString())); downloadState.SendingRequestStartTime = Math.Max(-1, long.Parse(match.Groups[3].ToString())); downloadState.SendingRequestEndTime = Math.Max(-1, long.Parse(match.Groups[4].ToString())); downloadState.ReceivingResponseStartTime = Math.Max(-1, long.Parse(match.Groups[5].ToString())); downloadState.ReceivingResponseEndTime = Math.Max(-1, long.Parse(match.Groups[6].ToString())); downloadState.ConnectionEndTime = Math.Max(-1, long.Parse(match.Groups[7].ToString())); downloadState.TotalSent = Math.Max(-1, int.Parse(match.Groups[8].ToString())); downloadState.TotalReceived = Math.Max(-1, int.Parse(match.Groups[9].ToString())); processedData.TotalDataReceived += downloadState.TotalReceived; processedData.TotalDataSent += downloadState.TotalSent; if (state != null) { if (downloadState.ConnectionStartTime > 0) { state.CollectionStartTime = Math.Min(state.CollectionStartTime, downloadState.ConnectionStartTime); } state.CollectionEndTime = Math.Max(state.CollectionEndTime, downloadState.ConnectionEndTime); } downloadState.URL = match.Groups[10].ToString(); processedData.AddLast(downloadState); type = GetURLType(downloadState.URL); downloadState.URLType = type; if (type == URLType.CSS) { processedData.TotalCSS++; processedData.TotalCSSWeight += downloadState.TotalReceived; } else if (type == URLType.Image) { processedData.TotalImages++; processedData.TotalImagesWeight += downloadState.TotalReceived; } else if (type == URLType.JS) { processedData.TotalJS++; processedData.TotalJSWeight += downloadState.TotalReceived; } } catch { } } return(processedData); }
private void Init(string pagePath, string pageClassName, string rexStr, string mime, bool enableScript, bool enableCache, string contentType, int age) { _pagePath = pagePath; _enableScript = enableScript; _enableCache = enableCache; if (string.IsNullOrEmpty(pageClassName)) _pageClassName = "Xy.Web,Xy.Web.Page.EmptyPage"; else _pageClassName = pageClassName; Runtime.Web.PageClassLibrary.Add(_pageClassName); _age = new TimeSpan(age / 60, age % 60, 0); switch (contentType) { case "MainContent": _contentType = URLType.MainContent; break; case "Prohibit": _contentType = URLType.Prohibit; break; case "ResourceFile": default: _contentType = URLType.ResourceFile; break; } if (_enableScript) { _contentType = URLType.MainContent; } if (!string.IsNullOrEmpty(rexStr)) { //_regex = new Regex(rexStr, RegexOptions.Compiled | RegexOptions.IgnoreCase); _regex = new Regex(rexStr, RegexOptions.Compiled); List<string> _groupsName = new List<string>(_regex.GetGroupNames()); for (int i = _groupsName.Count - 1; i >= 0; i--) { if (char.IsDigit(_groupsName[i], 0)) _groupsName.RemoveAt(i); } _URLGroupsName = _groupsName.ToArray(); } if (!string.IsNullOrEmpty(mime)) { _mime = mime; } }
public string GetURL(URLType type) { switch (type) { case URLType.URL: return ReturnLink(URL); case URLType.ThumbnailURL: return ReturnLink(ThumbnailURL); case URLType.DeletionURL: return ReturnLink(DeletionURL); } return null; }
/// <summary> /// /// </summary> /// <param name="_type"></param> /// <returns></returns> public string GetUrl(URLType _type) { string scriptName = "None"; switch (_type) { case URLType.Login: scriptName = LoginPhp; break; case URLType.Register: scriptName = RegisterPhp; break; case URLType.DataBase: scriptName = DataBasePhp; break; case URLType.Init: scriptName = InitPhp; break; case URLType.BanList: scriptName = BanListPhp; break; case URLType.Ranking: scriptName = RankingPhp; break; case URLType.Ban: scriptName = BanPhp; break; case URLType.ResetPassword: scriptName = ResetPassword; break; case URLType.ChangePassword: scriptName = ChangePassword; break; case URLType.RequestUser: scriptName = RequestUser; break; case URLType.Support: scriptName = SupportPhp; break; case URLType.Creator: scriptName = DataBaseCreator; break; case URLType.Clans: scriptName = ClanPhp; break; case URLType.Shop: scriptName = ShopPhp; break; } string url = string.Format("{0}{1}.php", PhpHostPath, scriptName); if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) { Debug.Log("URL is not well formed, please check if your php script have the same name and have assign the host path."); } return(url); }
public Stream UrlToStream(String sURL, Boolean okToRender) { if (MsxhelpProtocol.Catalog == null || !MsxhelpProtocol.Catalog.IsOpen) { return(null); } HelpQuery helpQuery; URLType urltype = UrlInfo(sURL, out helpQuery); String url = sURL.Replace("&", "&"); Stream stream = null; String assetPath = ""; CatalogRead _catalogRead = new CatalogRead(); // Indexed Topic -- ms-xhelp:///?method=page&id=SouthPark.Index&vendor=ACME Company&topicVersion=-1&topicLocale=EN-US // or an unrendered url: ms-xhelp:///?Id=SouthPark.EricCartman if (urltype == URLType.Topic) { _helpQuery = new HelpQuery(helpQuery.ToString()); HelpFilter filter = new HelpFilter(); if (!String.IsNullOrEmpty(_helpQuery.Vendor)) { filter.Add("vendor", _helpQuery.Vendor); } if (!String.IsNullOrEmpty(_helpQuery.TopicLocale)) { filter.Add("topiclocale", _helpQuery.TopicLocale); } if (!String.IsNullOrEmpty(_helpQuery.TopicVersion)) { filter.Add("topicversion", _helpQuery.TopicVersion); } //Get topic obj frome store String [] root = _helpQuery.AssetId.Split(new String[] { "%7c" }, StringSplitOptions.None); if (root.Length == 1) { _topic = (Topic)_catalogRead.GetIndexedTopicDetails(MsxhelpProtocol.Catalog, _helpQuery.AssetId, filter); } else if (root.Length == 3 && root[0] == "VS") { String[] path = root[2].Split(new string[] { "%5c" }, StringSplitOptions.None); if (root[1] == "winui") { // Create keyword list String name = path[path.Length - 1]; if (name.IndexOf(".") != -1) { name = name.Substring(0, name.IndexOf(".")); } String[] prioritizedF1Keywords = new String[1]; prioritizedF1Keywords[0] = "winuser/" + name; //Get topic obj frome store _topic = (Topic)_catalogRead.GetTopicDetailsForF1Keyword(MsxhelpProtocol.Catalog, prioritizedF1Keywords, filter); } } if (_topic != null) { // _topic.Package == _topic.Url = package.mshc;\\path (so we need to split to get the package) String[] url2 = _topic.Url.Split(new char[] { ';' }); if (url2.Length > 0) { helpQuery.Package = url2[0]; // "package.mshc" } _helpQuery.Package = helpQuery.Package; if (!String.IsNullOrEmpty(_topic.Locale)) { _helpQuery.Locale = _topic.Locale; } if (String.IsNullOrEmpty(_helpQuery.Locale)) { _helpQuery.Locale = MSLocales.ThreadLocale; } if (!String.IsNullOrEmpty(_topic.TopicLocale)) { _helpQuery.TopicLocale = _topic.TopicLocale; } if (!String.IsNullOrEmpty(_topic.TopicVersion)) { _helpQuery.TopicVersion = _topic.TopicVersion; } if (!String.IsNullOrEmpty(_topic.Vendor)) { _helpQuery.Vendor = _topic.Vendor; } //Special Case: Force modified text if (!String.IsNullOrEmpty(MsxhelpProtocol.UserTopicText)) { stream = MsxhelpProtocol.GetUserTopicAsStream(); } else { try { stream = (Stream)_topic.FetchContent(); //Normal fetch topic from store //this would also return the stream //stream = (Stream)_catalogRead.GetIndexedTopic(MsxhelpProtocol.Catalog, _topic.Id, null); } catch { stream = null; } } if (stream != null && okToRender) { new TopicStreamExpand(stream, helpQuery); // expand all links etc in the stream } } } // F1Keyword query "ms-xhelp:///?method=f1&query=SouthPark.Text" else if (urltype == URLType.F1Keyword) { _helpQuery = new HelpQuery(helpQuery.ToString()); MessageBox.Show(_helpQuery.QueryValue, "hi", MessageBoxButtons.OK); HelpFilter filter = new HelpFilter(); if (!String.IsNullOrEmpty(_helpQuery.Vendor)) { filter.Add("vendor", _helpQuery.Vendor); } if (!String.IsNullOrEmpty(_helpQuery.TopicLocale)) { filter.Add("topiclocale", _helpQuery.TopicLocale); } if (!String.IsNullOrEmpty(_helpQuery.TopicVersion)) { filter.Add("topicversion", _helpQuery.TopicVersion); } // Create keyword list String[] prioritizedF1Keywords = new String[1]; prioritizedF1Keywords[0] = _helpQuery.QueryValue; //Get topic obj frome store _topic = (Topic)_catalogRead.GetTopicDetailsForF1Keyword(MsxhelpProtocol.Catalog, prioritizedF1Keywords, filter); if (_topic != null) { // _topic.Package == _topic.Url = package.mshc;\\path (so we need to split to get the package) String[] url2 = _topic.Url.Split(new char[] { ';' }); if (url2.Length > 0) { helpQuery.Package = url2[0]; // "package.mshc" } _helpQuery.Package = helpQuery.Package; if (!String.IsNullOrEmpty(_topic.Locale)) { _helpQuery.Locale = _topic.Locale; } if (String.IsNullOrEmpty(_helpQuery.Locale)) { _helpQuery.Locale = MSLocales.ThreadLocale; } if (!String.IsNullOrEmpty(_topic.TopicLocale)) { _helpQuery.TopicLocale = _topic.TopicLocale; } if (!String.IsNullOrEmpty(_topic.TopicVersion)) { _helpQuery.TopicVersion = _topic.TopicVersion; } if (!String.IsNullOrEmpty(_topic.Vendor)) { _helpQuery.Vendor = _topic.Vendor; } //Special Case: Force modified text if (!String.IsNullOrEmpty(MsxhelpProtocol.UserTopicText)) { stream = MsxhelpProtocol.GetUserTopicAsStream(); } else { try { stream = (Stream)_topic.FetchContent(); //Normal fetch topic from store //this would also return the stream //stream = (Stream)_catalogRead.GetIndexedTopic(MsxhelpProtocol.Catalog, _topic.Id, null); } catch { stream = null; } } if (stream != null && okToRender) { new TopicStreamExpand(stream, helpQuery); // expand all links etc in the stream } } } // Branding package path "ms-xhelp:///?76555C51-8CF1-4FEB-81C4-BED857D94EBB_EN-US_Microsoft;/branding.js" else if (urltype == URLType.Branding) { if (url.StartsWith("76555C51-8CF1-4FEB-81C4-BED857D94EBB_", StringComparison.OrdinalIgnoreCase)) // xxxxx.css { assetPath = url.Replace("/", @"\"); } else { assetPath = url.Substring("ms-xhelp:///?".Length).Replace("/", @"\"); } String[] parts = assetPath.Split(new char[] { '_' }); String brandingLocale = parts[1]; assetPath = url.Split(new char[] { ';' })[1]; assetPath = assetPath.TrimStart(new char[] { '/' }); // For now we have branding files in a folder ".\Branding" Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); String BrandingDir = Path.Combine(Path.GetDirectoryName(thisAssembly.Location), "Branding"); String filePath = Path.Combine(BrandingDir, assetPath); if (!Directory.Exists(BrandingDir)) { MessageBox.Show("Branding folder not found: " + BrandingDir); stream = null; } else if (!File.Exists(filePath)) { MessageBox.Show("Branding file not found: " + filePath); stream = null; } else { FileStream fs = File.OpenRead(filePath); byte[] b = new byte[fs.Length]; fs.Read(b, 0, b.Length); fs.Close(); stream = new MemoryStream(b); } } // Asset -- "ms-xhelp:///?method=asset&id=XyzStyles.css&package=SOURCE HELP.mshc&topiclocale=EN-US" // Or some unrendered asset link ms-xhelp:///?xxxxx.css else if (urltype == URLType.Asset) { if (!String.IsNullOrEmpty(helpQuery.AssetId)) { assetPath = helpQuery.AssetId.Replace("/", @"\"); } else { assetPath = url.Substring("ms-xhelp:///".Length).Replace("/", @"\"); } if (String.IsNullOrEmpty(_helpQuery.Package) && !String.IsNullOrEmpty(helpQuery.Package)) { _helpQuery.Package = helpQuery.Package; } if (!String.IsNullOrEmpty(_helpQuery.Package) && !String.IsNullOrEmpty(assetPath)) { stream = (Stream)_catalogRead.GetLinkedAsset(MsxhelpProtocol.Catalog, _helpQuery.Package, assetPath, _helpQuery.Locale); } } return(stream); }
public URL() { Type = URLType.None; }
private void txtCustomUploaderURL_Enter(object sender, EventArgs e) { customUploaderURLType = URLType.URL; }
/// <summary> /// /// </summary> /// <param name="_type"></param> /// <returns></returns> public string GetUrl(URLType _type) { string scriptName = "None"; switch (_type) { case URLType.Login: scriptName = LoginPhp; break; case URLType.Register: scriptName = RegisterPhp; break; case URLType.DataBase: scriptName = DataBasePhp; break; case URLType.Init: scriptName = InitPhp; break; case URLType.BanList: scriptName = BanListPhp; break; case URLType.Admin: scriptName = AdminPhp; break; case URLType.Ranking: scriptName = RankingPhp; break; case URLType.Account: scriptName = AccountPhp; break; case URLType.Support: scriptName = SupportPhp; break; case URLType.Creator: scriptName = DataBaseCreator; break; case URLType.Clans: scriptName = ClanPhp; break; case URLType.Shop: scriptName = ShopPhp; break; case URLType.Security: scriptName = SecurityPhp; break; case URLType.OAuth: scriptName = OAuthPhp; break; } if (!PhpHostPath.EndsWith("/")) { PhpHostPath += "/"; } string url = string.Format("{0}{1}.php", PhpHostPath, scriptName); if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) { Debug.Log("URL is not well formed, please check if your php script have the same name and have assign the host path."); } return(url); }