Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@ -0,0 +1,61 @@
@* Generator: WebPagesHelper *@
@helper GetGoogleHtml(string webPropertyId) {
var webPropertyIdJson = new HtmlString(HttpUtility.JavaScriptStringEncode(webPropertyId, addDoubleQuotes: false));
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("@webPropertyIdJson");
pageTracker._trackPageview();
} catch(err) {}
</script>
}
@helper GetGoogleAsyncHtml(string webPropertyId) {
var webPropertyIdJson = new HtmlString(HttpUtility.JavaScriptStringEncode(webPropertyId, addDoubleQuotes: false));
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '@webPropertyIdJson']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
}
@helper GetYahooHtml(string account) {
var accountJson = new HtmlString(HttpUtility.JavaScriptStringEncode(account, addDoubleQuotes: false));
<script type="text/javascript">
window.ysm_customData = new Object();
window.ysm_customData.conversion = "transId=,currency=,amount=";
var ysm_accountid = "@accountJson";
document.write("<SCR" + "IPT language='JavaScript' type='text/javascript' "
+ "SRC=//" + "srv3.wa.marketingsolutions.yahoo.com" + "/script/ScriptServlet" + "?aid=" + ysm_accountid
+ "></SCR" + "IPT>");
</script>
}
@helper GetStatCounterHtml(int project, string security) {
var securityJson = new HtmlString(HttpUtility.JavaScriptStringEncode(security, addDoubleQuotes: false));
<script type="text/javascript">
var sc_project=@project;
var sc_invisible=1;
var sc_security="@securityJson";
var sc_text=2;
var sc_https=1;
var scJsHost = (("https:" == document.location.protocol) ? "https://secure." : "http://www.");
document.write("<sc" + "ript type='text/javascript' src='" + scJsHost + "statcounter.com/counter/counter_xhtml.js'></" + "script>");
</script>
<noscript>
<div class="statcounter">
<a title="tumblrstatistics" class="statcounter" href="http://www.statcounter.com/tumblr/"><img class="statcounter" src="https://c.statcounter.com/@project/0/@security/1/" alt="tumblr statistics"/></a></div>
</noscript>
}

View File

@ -0,0 +1,247 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Web.Helpers
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.WebPages.Html;
public class Analytics : System.Web.WebPages.HelperPage
{
public static System.Web.WebPages.HelperResult GetGoogleHtml(string webPropertyId) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 3 "..\..\Analytics.cshtml"
var webPropertyIdJson = new HtmlString(HttpUtility.JavaScriptStringEncode(webPropertyId, addDoubleQuotes: false));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, @" <script type=""text/javascript"">
var gaJsHost = ((""https:"" == document.location.protocol) ? ""https://ssl."" : ""http://www."");
document.write(unescape(""%3Cscript src='"" + gaJsHost + ""google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E""));
</script>
");
WriteLiteralTo(@__razor_helper_writer, " <script type=\"text/javascript\">\r\n try{\r\n var pageTracker = " +
"_gat._getTracker(\"");
#line 12 "..\..\Analytics.cshtml"
WriteTo(@__razor_helper_writer, webPropertyIdJson);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\");\r\n pageTracker._trackPageview();\r\n } catch(err) {}\r\n </sc" +
"ript>\r\n");
#line 16 "..\..\Analytics.cshtml"
#line default
#line hidden
});
}
public static System.Web.WebPages.HelperResult GetGoogleAsyncHtml(string webPropertyId) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 18 "..\..\Analytics.cshtml"
var webPropertyIdJson = new HtmlString(HttpUtility.JavaScriptStringEncode(webPropertyId, addDoubleQuotes: false));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <script type=\"text/javascript\">\r\n var _gaq = _gaq || [];\r\n _gaq" +
".push([\'_setAccount\', \'");
#line 22 "..\..\Analytics.cshtml"
WriteTo(@__razor_helper_writer, webPropertyIdJson);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, @"']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
");
#line 30 "..\..\Analytics.cshtml"
#line default
#line hidden
});
}
public static System.Web.WebPages.HelperResult GetYahooHtml(string account) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 32 "..\..\Analytics.cshtml"
var accountJson = new HtmlString(HttpUtility.JavaScriptStringEncode(account, addDoubleQuotes: false));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <script type=\"text/javascript\">\r\n window.ysm_customData = new Object()" +
";\r\n window.ysm_customData.conversion = \"transId=,currency=,amount=\";\r\n " +
" var ysm_accountid = \"");
#line 37 "..\..\Analytics.cshtml"
WriteTo(@__razor_helper_writer, accountJson);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\";\r\n document.write(\"<SCR\" + \"IPT language=\'JavaScript\' type=\'text/javascr" +
"ipt\' \"\r\n + \"SRC=//\" + \"srv3.wa.marketingsolutions.yahoo.com\" + \"/script/S" +
"criptServlet\" + \"?aid=\" + ysm_accountid\r\n + \"></SCR\" + \"IPT>\");\r\n </sc" +
"ript>\r\n");
#line 42 "..\..\Analytics.cshtml"
#line default
#line hidden
});
}
public static System.Web.WebPages.HelperResult GetStatCounterHtml(int project, string security) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 44 "..\..\Analytics.cshtml"
var securityJson = new HtmlString(HttpUtility.JavaScriptStringEncode(security, addDoubleQuotes: false));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <script type=\"text/javascript\">\r\n var sc_project=");
#line 48 "..\..\Analytics.cshtml"
WriteTo(@__razor_helper_writer, project);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, ";\r\n var sc_invisible=1;\r\n var sc_security=\"");
#line 50 "..\..\Analytics.cshtml"
WriteTo(@__razor_helper_writer, securityJson);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, @""";
var sc_text=2;
var sc_https=1;
var scJsHost = ((""https:"" == document.location.protocol) ? ""https://secure."" : ""http://www."");
document.write(""<sc"" + ""ript type='text/javascript' src='"" + scJsHost + ""statcounter.com/counter/counter_xhtml.js'></"" + ""script>"");
</script>
");
WriteLiteralTo(@__razor_helper_writer, " <noscript>\r\n <div class=\"statcounter\">\r\n <a title=\"tumblrstatistics\" cl" +
"ass=\"statcounter\" href=\"http://www.statcounter.com/tumblr/\"><img class=\"statcoun" +
"ter\" src=\"https://c.statcounter.com/");
#line 58 "..\..\Analytics.cshtml"
WriteTo(@__razor_helper_writer, project);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "/0/");
#line 58 "..\..\Analytics.cshtml"
WriteTo(@__razor_helper_writer, security);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "/1/\" alt=\"tumblr statistics\"/></a></div>\r\n </noscript>\r\n");
#line 60 "..\..\Analytics.cshtml"
#line default
#line hidden
});
}
public Analytics()
{
}
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,93 @@
@* Generator: WebPagesHelper *@
@using System.Globalization
@using System.Web
@using System.Web.WebPages.Scope
@using Microsoft.Internal.Web.Utils
@using Resources
@functions {
private const string DefaultBoxWidth = "322px";
internal static readonly object _siteTitleKey = new object();
internal static readonly object _siteUrlKey = new object();
public static string SiteTitle {
get {
return ScopeStorage.CurrentScope[_siteTitleKey] as string;
}
set {
if (value == null) {
throw new ArgumentNullException("SiteTitle");
}
ScopeStorage.CurrentScope[_siteTitleKey] = value;
}
}
public static string SiteUrl {
get {
return ScopeStorage.CurrentScope[_siteUrlKey] as string;
}
set {
if (value == null) {
throw new ArgumentNullException("SiteUrl");
}
ScopeStorage.CurrentScope[_siteUrlKey] = value;
}
}
private static int GetCodePageFromRequest(HttpContextBase httpContext) {
return httpContext.Response.ContentEncoding.CodePage;
}
private static string GetSiteUrl(IDictionary<object, object> scopeStorage, string siteUrl) {
object result;
if (siteUrl.IsEmpty() && scopeStorage.TryGetValue(_siteUrlKey, out result)){
siteUrl = result as string;
}
return siteUrl;
}
private static string GetSiteTitle(IDictionary<object, object> scopeStorage, string siteTitle) {
object result;
if (siteTitle.IsEmpty() && scopeStorage.TryGetValue(_siteTitleKey, out result)) {
siteTitle = result as string;
}
return siteTitle;
}
}
@helper SearchBox(string boxWidth = DefaultBoxWidth, string siteUrl = null, string siteTitle = null) {
@_SearchBox(boxWidth, siteUrl, siteTitle, new HttpContextWrapper(HttpContext.Current), ScopeStorage.CurrentScope)
}
@helper _SearchBox(string boxWidth, string siteUrl, string siteTitle, HttpContextBase context, IDictionary<object, object> scopeStorage) {
siteTitle = GetSiteTitle(scopeStorage, siteTitle);
siteUrl = GetSiteUrl(scopeStorage, siteUrl);
string searchSite = String.IsNullOrEmpty(siteTitle) ? HelpersToolkitResources.BingSearch_DefaultSiteSearchText : siteTitle;
<form action="http://www.bing.com/search" class="BingSearch" method="get" target="_blank">
<input name="FORM" type="hidden" value="FREESS" />
<input name="cp" type="hidden" value="@GetCodePageFromRequest(context)" />
<table cellpadding="0" cellspacing="0" style="width:@boxWidth;">
<tr style="height: 32px">
<td style="width: 100%; border:solid 1px #ccc; border-right-style:none; padding-left:10px; padding-right:10px; vertical-align:middle;">
<input name="q" style="background-image:url(http://www.bing.com/siteowner/s/siteowner/searchbox_background_k.png); background-position:right; background-repeat:no-repeat; font-family:Arial; font-size:14px; color:#000; width:100%; border:none 0 transparent;" title="Search Bing" type="text" />
</td>
<td style="border:solid 1px #ccc; border-left-style:none; padding-left:0px; padding-right:3px;">
<input alt="Search" src="http://www.bing.com/siteowner/s/siteowner/searchbutton_normal_k.gif" style="border:none 0 transparent; height:24px; width:24px; vertical-align:top;" type="image" />
</td>
</tr>
@if (!String.IsNullOrEmpty(siteUrl)) {
<tr>
<td colspan="2" style="font-size: small">
<label><input checked="checked" name="q1" type="radio" value="site:@siteUrl" />@searchSite</label>&nbsp;<label><input name="q1" type="radio" value="" />@HelpersToolkitResources.BingSearch_DefaultWebSearchText</label>
</td>
</tr>
}
</table>
</form>
}

View File

@ -0,0 +1,257 @@
using Resources;
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Web.Helpers
{
using System;
using System.Collections.Generic;
#line 3 "..\..\Bing.cshtml"
using System.Globalization;
#line default
#line hidden
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
#line 4 "..\..\Bing.cshtml"
using System.Web;
#line default
#line hidden
using System.Web.Helpers;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.WebPages.Html;
#line 5 "..\..\Bing.cshtml"
using System.Web.WebPages.Scope;
#line default
#line hidden
#line 6 "..\..\Bing.cshtml"
using Microsoft.Internal.Web.Utils;
#line default
#line hidden
public class Bing : System.Web.WebPages.HelperPage
{
#line 8 "..\..\Bing.cshtml"
private const string DefaultBoxWidth = "322px";
internal static readonly object _siteTitleKey = new object();
internal static readonly object _siteUrlKey = new object();
public static string SiteTitle {
get {
return ScopeStorage.CurrentScope[_siteTitleKey] as string;
}
set {
if (value == null) {
throw new ArgumentNullException("SiteTitle");
}
ScopeStorage.CurrentScope[_siteTitleKey] = value;
}
}
public static string SiteUrl {
get {
return ScopeStorage.CurrentScope[_siteUrlKey] as string;
}
set {
if (value == null) {
throw new ArgumentNullException("SiteUrl");
}
ScopeStorage.CurrentScope[_siteUrlKey] = value;
}
}
private static int GetCodePageFromRequest(HttpContextBase httpContext) {
return httpContext.Response.ContentEncoding.CodePage;
}
private static string GetSiteUrl(IDictionary<object, object> scopeStorage, string siteUrl) {
object result;
if (siteUrl.IsEmpty() && scopeStorage.TryGetValue(_siteUrlKey, out result)){
siteUrl = result as string;
}
return siteUrl;
}
private static string GetSiteTitle(IDictionary<object, object> scopeStorage, string siteTitle) {
object result;
if (siteTitle.IsEmpty() && scopeStorage.TryGetValue(_siteTitleKey, out result)) {
siteTitle = result as string;
}
return siteTitle;
}
#line default
#line hidden
public static System.Web.WebPages.HelperResult SearchBox(string boxWidth = DefaultBoxWidth, string siteUrl = null, string siteTitle = null) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 61 "..\..\Bing.cshtml"
#line default
#line hidden
#line 62 "..\..\Bing.cshtml"
WriteTo(@__razor_helper_writer, _SearchBox(boxWidth, siteUrl, siteTitle, new HttpContextWrapper(HttpContext.Current), ScopeStorage.CurrentScope));
#line default
#line hidden
#line 62 "..\..\Bing.cshtml"
#line default
#line hidden
});
}
internal static System.Web.WebPages.HelperResult _SearchBox(string boxWidth, string siteUrl, string siteTitle, HttpContextBase context, IDictionary<object, object> scopeStorage) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 65 "..\..\Bing.cshtml"
siteTitle = GetSiteTitle(scopeStorage, siteTitle);
siteUrl = GetSiteUrl(scopeStorage, siteUrl);
string searchSite = String.IsNullOrEmpty(siteTitle) ? HelpersToolkitResources.BingSearch_DefaultSiteSearchText : siteTitle;
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <form action=\"http://www.bing.com/search\" class=\"BingSearch\" method=\"get\" tar" +
"get=\"_blank\">\r\n <input name=\"FORM\" type=\"hidden\" value=\"FREESS\" />\r\n <inpu" +
"t name=\"cp\" type=\"hidden\" value=\"");
#line 72 "..\..\Bing.cshtml"
WriteTo(@__razor_helper_writer, GetCodePageFromRequest(context));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\" />\r\n <table cellpadding=\"0\" cellspacing=\"0\" style=\"width:");
#line 73 "..\..\Bing.cshtml"
WriteTo(@__razor_helper_writer, boxWidth);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, @";"">
<tr style=""height: 32px"">
<td style=""width: 100%; border:solid 1px #ccc; border-right-style:none; padding-left:10px; padding-right:10px; vertical-align:middle;"">
<input name=""q"" style=""background-image:url(http://www.bing.com/siteowner/s/siteowner/searchbox_background_k.png); background-position:right; background-repeat:no-repeat; font-family:Arial; font-size:14px; color:#000; width:100%; border:none 0 transparent;"" title=""Search Bing"" type=""text"" />
</td>
<td style=""border:solid 1px #ccc; border-left-style:none; padding-left:0px; padding-right:3px;"">
<input alt=""Search"" src=""http://www.bing.com/siteowner/s/siteowner/searchbutton_normal_k.gif"" style=""border:none 0 transparent; height:24px; width:24px; vertical-align:top;"" type=""image"" />
</td>
</tr>
");
#line 82 "..\..\Bing.cshtml"
if (!String.IsNullOrEmpty(siteUrl)) {
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <tr>\r\n <td colspan=\"2\" style=\"font-size: small\">\r\n <label><" +
"input checked=\"checked\" name=\"q1\" type=\"radio\" value=\"site:");
#line 85 "..\..\Bing.cshtml"
WriteTo(@__razor_helper_writer, siteUrl);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\" />");
#line 85 "..\..\Bing.cshtml"
WriteTo(@__razor_helper_writer, searchSite);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "</label>&nbsp;<label><input name=\"q1\" type=\"radio\" value=\"\" />");
#line 85 "..\..\Bing.cshtml"
WriteTo(@__razor_helper_writer, HelpersToolkitResources.BingSearch_DefaultWebSearchText);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "</label>\r\n </td>\r\n </tr>\r\n");
#line 88 "..\..\Bing.cshtml"
}
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " </table>\r\n </form>\r\n");
#line 91 "..\..\Bing.cshtml"
#line default
#line hidden
});
}
public Bing()
{
}
}
}
#pragma warning restore 1591

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,111 @@
@* Generator: WebPagesHelper *@
@using System.Globalization
@using System.Web
@using Microsoft.Internal.Web.Utils
@using Resources
@functions {
private class FileUploadTracker {
private static readonly object _countKey = new object();
private static readonly object _scriptAlreadyRendered = new object();
private readonly HttpContextBase _httpContext;
public FileUploadTracker(HttpContextBase httpContext) {
_httpContext = httpContext;
}
public bool ScriptAlreadyRendered {
get {
bool? rendered = _httpContext.Items[_scriptAlreadyRendered] as bool?;
return rendered.HasValue && rendered.Value;
}
set {
_httpContext.Items[_scriptAlreadyRendered] = value;
}
}
public int RenderCount {
get {
int? count = _httpContext.Items[_countKey] as int?;
if (!count.HasValue) {
count = 0;
}
return count.Value;
}
set {
_httpContext.Items[_countKey] = value;
}
}
}
}
@helper GetHtml(string name = null,
int initialNumberOfFiles = 1,
bool allowMoreFilesToBeAdded = true,
bool includeFormTag = true,
string addText = null,
string uploadText = null) {
@_GetHtml(new HttpContextWrapper(HttpContext.Current), name, initialNumberOfFiles, allowMoreFilesToBeAdded,
includeFormTag, addText, uploadText)
}
@helper _GetHtml(HttpContextBase context, string name, int initialNumberOfFiles,
bool allowMoreFilesToBeAdded, bool includeFormTag, string addText, string uploadText) {
if (initialNumberOfFiles < 0) {
throw new ArgumentOutOfRangeException(
"initialNumberOfFiles",
String.Format(CultureInfo.InvariantCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "0"));
}
var tracker = new FileUploadTracker(context);
int count = tracker.RenderCount++;
name = name ?? "fileUpload";
uploadText = uploadText ?? HelpersToolkitResources.FileUpload_Upload;
addText = addText ?? HelpersToolkitResources.FileUpload_AddMore;
if (allowMoreFilesToBeAdded && !tracker.ScriptAlreadyRendered) {
tracker.ScriptAlreadyRendered = true;
<script type="text/javascript">
if (!window["FileUploadHelper"]) window["FileUploadHelper"] = {};
FileUploadHelper.addInputElement = function(index, name) {
var inputElem = document.createElement("input");
inputElem.type = "file";
inputElem.name = name;
var divElem = document.createElement("div");
divElem.appendChild(inputElem.cloneNode(false));
var inputs = document.getElementById("file-upload-" + index);
inputs.appendChild(divElem);
}
</script>
}
if (includeFormTag) {
@:<form action="" enctype="multipart/form-data" method="post">
}
<div class="file-upload" id="file-upload-@(count)">
@for(int i = 0; i < initialNumberOfFiles; i++) {
<div>
<input name="@name" type="file" />
</div>
}
</div>
if (allowMoreFilesToBeAdded || includeFormTag) {
<div class="file-upload-buttons">
@if (allowMoreFilesToBeAdded) {
<a href="#" onclick="FileUploadHelper.addInputElement(@count, @HttpUtility.JavaScriptStringEncode(name, addDoubleQuotes: true)); return false;">@addText</a>
}
@if (includeFormTag) {
<input type="submit" value="@uploadText" />
}
</div>
}
if (includeFormTag) {
@:</form>
}
}

View File

@ -0,0 +1,351 @@
using Resources;
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Web.Helpers
{
using System;
using System.Collections.Generic;
#line 3 "..\..\FileUpload.cshtml"
using System.Globalization;
#line default
#line hidden
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
#line 4 "..\..\FileUpload.cshtml"
using System.Web;
#line default
#line hidden
using System.Web.Helpers;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.WebPages.Html;
#line 5 "..\..\FileUpload.cshtml"
using Microsoft.Internal.Web.Utils;
#line default
#line hidden
public class FileUpload : System.Web.WebPages.HelperPage
{
#line 7 "..\..\FileUpload.cshtml"
private class FileUploadTracker {
private static readonly object _countKey = new object();
private static readonly object _scriptAlreadyRendered = new object();
private readonly HttpContextBase _httpContext;
public FileUploadTracker(HttpContextBase httpContext) {
_httpContext = httpContext;
}
public bool ScriptAlreadyRendered {
get {
bool? rendered = _httpContext.Items[_scriptAlreadyRendered] as bool?;
return rendered.HasValue && rendered.Value;
}
set {
_httpContext.Items[_scriptAlreadyRendered] = value;
}
}
public int RenderCount {
get {
int? count = _httpContext.Items[_countKey] as int?;
if (!count.HasValue) {
count = 0;
}
return count.Value;
}
set {
_httpContext.Items[_countKey] = value;
}
}
}
#line default
#line hidden
public static System.Web.WebPages.HelperResult GetHtml(string name = null,
int initialNumberOfFiles = 1,
bool allowMoreFilesToBeAdded = true,
bool includeFormTag = true,
string addText = null,
string uploadText = null) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 47 "..\..\FileUpload.cshtml"
#line default
#line hidden
#line 48 "..\..\FileUpload.cshtml"
WriteTo(@__razor_helper_writer, _GetHtml(new HttpContextWrapper(HttpContext.Current), name, initialNumberOfFiles, allowMoreFilesToBeAdded,
includeFormTag, addText, uploadText));
#line default
#line hidden
#line 49 "..\..\FileUpload.cshtml"
#line default
#line hidden
});
}
internal static System.Web.WebPages.HelperResult _GetHtml(HttpContextBase context, string name, int initialNumberOfFiles,
bool allowMoreFilesToBeAdded, bool includeFormTag, string addText, string uploadText) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 53 "..\..\FileUpload.cshtml"
if (initialNumberOfFiles < 0) {
throw new ArgumentOutOfRangeException(
"initialNumberOfFiles",
String.Format(CultureInfo.InvariantCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "0"));
}
var tracker = new FileUploadTracker(context);
int count = tracker.RenderCount++;
name = name ?? "fileUpload";
uploadText = uploadText ?? HelpersToolkitResources.FileUpload_Upload;
addText = addText ?? HelpersToolkitResources.FileUpload_AddMore;
if (allowMoreFilesToBeAdded && !tracker.ScriptAlreadyRendered) {
tracker.ScriptAlreadyRendered = true;
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, @" <script type=""text/javascript"">
if (!window[""FileUploadHelper""]) window[""FileUploadHelper""] = {};
FileUploadHelper.addInputElement = function(index, name) {
var inputElem = document.createElement(""input"");
inputElem.type = ""file"";
inputElem.name = name;
var divElem = document.createElement(""div"");
divElem.appendChild(inputElem.cloneNode(false));
var inputs = document.getElementById(""file-upload-"" + index);
inputs.appendChild(divElem);
}
</script>
");
#line 83 "..\..\FileUpload.cshtml"
}
if (includeFormTag) {
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " ");
WriteLiteralTo(@__razor_helper_writer, "<form action=\"\" enctype=\"multipart/form-data\" method=\"post\">\r\n");
#line 87 "..\..\FileUpload.cshtml"
}
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <div class=\"file-upload\" id=\"file-upload-");
#line 88 "..\..\FileUpload.cshtml"
WriteTo(@__razor_helper_writer, count);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\">\r\n");
#line 89 "..\..\FileUpload.cshtml"
for(int i = 0; i < initialNumberOfFiles; i++) {
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <div>\r\n <input name=\"");
#line 91 "..\..\FileUpload.cshtml"
WriteTo(@__razor_helper_writer, name);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\" type=\"file\" />\r\n </div>\r\n");
#line 93 "..\..\FileUpload.cshtml"
}
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " </div>\r\n");
#line 95 "..\..\FileUpload.cshtml"
if (allowMoreFilesToBeAdded || includeFormTag) {
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <div class=\"file-upload-buttons\">\r\n");
#line 98 "..\..\FileUpload.cshtml"
if (allowMoreFilesToBeAdded) {
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <a href=\"#\" onclick=\"FileUploadHelper.addInputElement(");
#line 99 "..\..\FileUpload.cshtml"
WriteTo(@__razor_helper_writer, count);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, ", ");
#line 99 "..\..\FileUpload.cshtml"
WriteTo(@__razor_helper_writer, HttpUtility.JavaScriptStringEncode(name, addDoubleQuotes: true));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "); return false;\">");
#line 99 "..\..\FileUpload.cshtml"
WriteTo(@__razor_helper_writer, addText);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "</a>\r\n");
#line 100 "..\..\FileUpload.cshtml"
}
#line default
#line hidden
#line 101 "..\..\FileUpload.cshtml"
if (includeFormTag) {
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <input type=\"submit\" value=\"");
#line 102 "..\..\FileUpload.cshtml"
WriteTo(@__razor_helper_writer, uploadText);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\" />\r\n");
#line 103 "..\..\FileUpload.cshtml"
}
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " </div>\r\n");
#line 105 "..\..\FileUpload.cshtml"
}
if (includeFormTag) {
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " ");
WriteLiteralTo(@__razor_helper_writer, "</form>\r\n");
#line 109 "..\..\FileUpload.cshtml"
}
#line default
#line hidden
});
}
public FileUpload()
{
}
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,10 @@
@* Generator: WebPagesHelper *@
@using Microsoft.Internal.Web.Utils
@helper GetHtml(string gamerTag) {
if (gamerTag.IsEmpty()) {
throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "gamerTag");
}
<iframe frameborder="0" height="140" scrolling="no" src="http://gamercard.xbox.com/@(HttpUtility.UrlPathEncode(gamerTag)).card" width="204">@gamerTag</iframe>
}

View File

@ -0,0 +1,90 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Web.Helpers
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.WebPages.Html;
#line 3 "..\..\GamerCard.cshtml"
using Microsoft.Internal.Web.Utils;
#line default
#line hidden
public class GamerCard : System.Web.WebPages.HelperPage
{
public static System.Web.WebPages.HelperResult GetHtml(string gamerTag) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 5 "..\..\GamerCard.cshtml"
if (gamerTag.IsEmpty()) {
throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "gamerTag");
}
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <iframe frameborder=\"0\" height=\"140\" scrolling=\"no\" src=\"http://gamercard.xbo" +
"x.com/");
#line 9 "..\..\GamerCard.cshtml"
WriteTo(@__razor_helper_writer, HttpUtility.UrlPathEncode(gamerTag));
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, ".card\" width=\"204\">");
#line 9 "..\..\GamerCard.cshtml"
WriteTo(@__razor_helper_writer, gamerTag);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "</iframe>\r\n");
#line 10 "..\..\GamerCard.cshtml"
#line default
#line hidden
});
}
public GamerCard()
{
}
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,70 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#GetInitializationScripts()", Justification = "It is analogous to the get pattern users are familiar with")]
[assembly: SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#GetFacebookUserProfile()", Justification = "It is analogous to the get pattern users are familiar with")]
[assembly: SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Scope = "type", Target = "Microsoft.Web.Helpers.Maps+MapLocation",
Justification = "This type is only meant to be consumed but not instantiated by users.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors", Scope = "type", Target = "Microsoft.Web.Helpers.Analytics", Justification = "This is the default format in which helpers are generated.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors", Scope = "type", Target = "Microsoft.Web.Helpers.Bing", Justification = "This is the default format in which helpers are generated.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors", Scope = "type", Target = "Microsoft.Web.Helpers.Facebook", Justification = "This is the default format in which helpers are generated.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors", Scope = "type", Target = "Microsoft.Web.Helpers.FileUpload", Justification = "This is the default format in which helpers are generated.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors", Scope = "type", Target = "Microsoft.Web.Helpers.GamerCard", Justification = "This is the default format in which helpers are generated.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors", Scope = "type", Target = "Microsoft.Web.Helpers.LinkShare", Justification = "This is the default format in which helpers are generated.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors", Scope = "type", Target = "Microsoft.Web.Helpers.Maps", Justification = "This is the default format in which helpers are generated.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors", Scope = "type", Target = "Microsoft.Web.Helpers.ReCaptcha", Justification = "This is the default format in which helpers are generated.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors", Scope = "type", Target = "Microsoft.Web.Helpers.Twitter", Justification = "This is the default format in which helpers are generated.")]
[assembly: SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "2#", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#LoginButton(System.String,System.String,System.String,System.String,System.Boolean,System.String,System.String,System.Boolean,System.String)", Justification = "We prefer strings to URIs for helpers")]
[assembly: SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "4#", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#OpenGraphRequiredProperties(System.String,System.String,System.String,System.String,System.String,System.String)", Justification = "We prefer strings to URIs for helpers")]
[assembly: SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "0#", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#LoginButton(System.String,System.String,System.String,System.String,System.Boolean,System.String,System.String,System.Boolean,System.String)", Justification = "We prefer strings to URIs for helpers")]
[assembly: SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "1#", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#LoginButton(System.String,System.String,System.String,System.String,System.Boolean,System.String,System.String,System.Boolean,System.String)", Justification = "We prefer strings to URIs for helpers")]
[assembly: SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "1#", Scope = "member", Target = "Microsoft.Web.Helpers.Bing.#SearchBox(System.String,System.String,System.String)", Justification = "We prefer strings to URIs for helpers")]
[assembly: SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "3#", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#OpenGraphRequiredProperties(System.String,System.String,System.String,System.String,System.String,System.String)", Justification = "We prefer strings to URIs for helpers")]
[assembly: SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "3#", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#TweetButton(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)", Justification = "We prefer strings to URIs for helpers")]
[assembly: SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "3#", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#LiveStream(System.Int32,System.Int32,System.String,System.String,System.Boolean)", Justification = "We prefer strings to URIs for helpers")]
[assembly: SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings", Scope = "member", Target = "Microsoft.Web.Helpers.Bing.#SiteUrl", Justification = "We prefer strings to URIs for helpers")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Web.Helpers.Twitter.RawJS(System.String)", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Faves(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Web.Helpers.Twitter.RawJS(System.String)", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#List(System.String,System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "Value is a hex color code")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Web.Helpers.Twitter.RawJS(System.String)", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Profile(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "Value is a hex color code")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Microsoft.Web.Helpers.Twitter.RawJS(System.String)", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Search(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "Value is a hex color code")]
[assembly: SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible", Scope = "type", Target = "Microsoft.Web.Helpers.Facebook+UserProfile", Justification = "The type is consumed but never instantiated by a user")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Web.Helpers.Maps.#GetBingHtml(System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.String,System.Boolean,System.String,System.Collections.Generic.IEnumerable`1<Microsoft.Web.Helpers.Maps+MapLocation>)", Justification = "We're printing a JSON value that needs to be lower case")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Faves(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "We're printing a JSON value that needs to be lower case")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#List(System.String,System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "We're printing a JSON value that needs to be lower case")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Profile(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "We're printing a JSON value that needs to be lower case")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Search(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "We're printing a JSON value that needs to be lower case")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Facepile", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#Facepile(System.Int32,System.Int32)", Justification = "Facebook related term")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Faves", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Faves(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "Facebook related term")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Fbml", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#FbmlNamespaces()", Justification = "Facebook related term")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "num", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#Comments(System.String,System.Int32,System.Int32,System.Boolean,System.Boolean)", Justification = "num is not Hungarian notation")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "xid", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#Comments(System.String,System.Int32,System.Int32,System.Boolean,System.Boolean)", Justification = "Facebook related term")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "xid", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#LiveStream(System.Int32,System.Int32,System.String,System.String,System.Boolean)", Justification = "Facebook related term")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#TweetButton(System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.String)")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Re", Scope = "type", Target = "Microsoft.Web.Helpers.ReCaptcha")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames", MessageId = "1#", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#List(System.String,System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "The parameter corresponds a Twitter API parameter")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Logout", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#LoginButton(System.String,System.String,System.String,System.String,System.Boolean,System.String,System.String,System.Boolean,System.String)", Justification = "We use login and logout in WebMatrix.Security")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Login", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#LoginButtonTagOnly(System.String,System.Boolean,System.String,System.String,System.String,System.Boolean,System.String)", Justification = "We use login and logout in WebMatrix.Security")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Logout", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#LoginButtonTagOnly(System.String,System.Boolean,System.String,System.String,System.String,System.Boolean,System.String)", Justification = "We use login and logout in WebMatrix.Security")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Login", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#LoginButton(System.String,System.String,System.String,System.String,System.Boolean,System.String,System.String,System.Boolean,System.String)", Justification = "We use login and logout in WebMatrix.Security")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Login", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook.#MembershipLogin()", Justification = "We use login and logout in WebMatrix.Security")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "Login", Scope = "member", Target = "Microsoft.Web.Helpers.LinkShare.#BitlyLogin", Justification = "We use login and logout in WebMatrix.Security")]
[assembly: SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ffffff", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Faves(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "Value is a hex color value")]
[assembly: SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ffffff", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#List(System.String,System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "Value is a hex color value")]
[assembly: SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ffffff", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Profile(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "Value is a hex color value")]
[assembly: SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "ffffff", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Search(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)", Justification = "Value is a hex color value")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.Bing.#SiteUrl", Justification = "Property name is used instead of the generic term value to make it simpler to debug.")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.GamerCard.#GetHtml(System.String)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.LinkShare.#GetHtml(System.String,System.String,System.String,System.String,Microsoft.Web.Helpers.LinkShareSite[])")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.Maps.#GetBingHtml(System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.String,System.Boolean,System.String,System.Collections.Generic.IEnumerable`1<Microsoft.Web.Helpers.Maps+MapLocation>)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.Maps.#GetMapQuestHtml(System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.String,System.Boolean,System.String,System.Boolean,System.Collections.Generic.IEnumerable`1<Microsoft.Web.Helpers.Maps+MapLocation>)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.Maps.#GetYahooHtml(System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.String,System.Boolean,System.String,System.Collections.Generic.IEnumerable`1<Microsoft.Web.Helpers.Maps+MapLocation>)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Faves(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#List(System.String,System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Profile(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.Int32,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.Bing.#SiteTitle", Justification = "Property name is used instead of the generic term value to make it simpler to debug.")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Scope = "member", Target = "Microsoft.Web.Helpers.Twitter.#Search(System.String,System.Int32,System.Int32,System.String,System.String,System.String,System.String,System.String,System.String,System.String,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.String,System.Int32)")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook+UserProfile.#Updated_Time", Justification = "This is serailzed from a JSON schema, so member names have to be exactly this way.")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook+UserProfile.#Last_Name", Justification = "This is serailzed from a JSON schema, so member names have to be exactly this way.")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook+UserProfile.#First_Name", Justification = "This is serailzed from a JSON schema, so member names have to be exactly this way.")]
[assembly: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Timezone", Scope = "member", Target = "Microsoft.Web.Helpers.Facebook+UserProfile.#Timezone", Justification = "This is serailzed from a JSON schema, so member names have to be exactly this way.")]

View File

@ -0,0 +1,99 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Helpers;
using Microsoft.Internal.Web.Utils;
using Resources;
namespace Microsoft.Web.Helpers
{
public static class Gravatar
{
private const string GravatarUrl = "http://www.gravatar.com/avatar/";
// review - extract conversion of anonymous object to html attributes string into separate helper
public static HtmlString GetHtml(string email, int imageSize = 80, string defaultImage = null,
GravatarRating rating = GravatarRating.Default, string imageExtension = null, object attributes = null)
{
bool altSpecified = false;
string url = GetUrl(email, imageSize, defaultImage, rating, imageExtension);
StringBuilder html = new StringBuilder(String.Format(CultureInfo.InvariantCulture, "<img src=\"{0}\" ", url));
if (attributes != null)
{
foreach (var p in attributes.GetType().GetProperties().OrderBy(p => p.Name))
{
if (!p.Name.Equals("src", StringComparison.OrdinalIgnoreCase))
{
object value = p.GetValue(attributes, null);
if (value != null)
{
string encodedValue = HttpUtility.HtmlAttributeEncode(value.ToString());
html.Append(String.Format(CultureInfo.InvariantCulture, "{0}=\"{1}\" ", p.Name, encodedValue));
}
if (p.Name.Equals("alt", StringComparison.OrdinalIgnoreCase))
{
altSpecified = true;
}
}
}
}
if (!altSpecified)
{
html.Append("alt=\"gravatar\" ");
}
html.Append("/>");
return new HtmlString(html.ToString());
}
// See: http://en.gravatar.com/site/implement/url
[SuppressMessage("Microsoft.Design", "CA1055:UriReturnValuesShouldNotBeStrings", Justification = "Strings are easier to work with for Plan9 scenario")]
[SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Gravatar.com requires lowercase")]
public static string GetUrl(string email, int imageSize = 80, string defaultImage = null,
GravatarRating rating = GravatarRating.Default, string imageExtension = null)
{
if (String.IsNullOrEmpty(email))
{
throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "email");
}
if ((imageSize <= 0) || (imageSize > 512))
{
throw new ArgumentException(HelpersToolkitResources.Gravatar_InvalidImageSize, "imageSize");
}
StringBuilder url = new StringBuilder(GravatarUrl);
email = email.Trim().ToLowerInvariant();
url.Append(Crypto.Hash(email, algorithm: "md5").ToLowerInvariant());
if (!String.IsNullOrEmpty(imageExtension))
{
if (!imageExtension.StartsWith(".", StringComparison.Ordinal))
{
url.Append('.');
}
url.Append(imageExtension);
}
url.Append("?s=");
url.Append(imageSize);
if (rating != GravatarRating.Default)
{
url.Append("&r=");
url.Append(rating.ToString().ToLowerInvariant());
}
if (!String.IsNullOrEmpty(defaultImage))
{
url.Append("&d=");
url.Append(HttpUtility.UrlEncode(defaultImage));
}
return HttpUtility.HtmlAttributeEncode(url.ToString());
}
}
}

View File

@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.Web.Helpers
{
public enum GravatarRating
{
Default,
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "G", Justification = "Matches the gravatar.com rating. Suppressed in source because this is a one-time occurrence")]
G,
PG,
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "R", Justification = "Matches the gravatar.com rating. Suppressed in source because this is a one-time occurrence")]
R,
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "X", Justification = "Matches the gravatar.com rating. Suppressed in source because this is a one-time occurrence")]
X
}
}

View File

@ -0,0 +1,181 @@
@* Generator: WebPagesHelper *@
@using System.Globalization
@using System.Text
@using System.Web.WebPages.Scope
@using Microsoft.Internal.Web.Utils
@functions {
internal static readonly object _bitlyApiKey = new object();
internal static readonly object _bitlyLogin = new object();
private static readonly Lazy<IEnumerable<LinkShareSite>> _allSites = new Lazy<IEnumerable<LinkShareSite>>(() =>
from site in (LinkShareSite[])Enum.GetValues(typeof(LinkShareSite))
where site != LinkShareSite.All
select site
);
public static string BitlyApiKey {
get {
return ScopeStorage.CurrentScope[_bitlyApiKey] as string;
}
set {
if (value == null) {
throw new ArgumentNullException("value");
}
ScopeStorage.CurrentScope[_bitlyApiKey] = value;
}
}
public static string BitlyLogin {
get {
return ScopeStorage.CurrentScope[_bitlyLogin] as string;
}
set {
if (value == null) {
throw new ArgumentNullException("value");
}
ScopeStorage.CurrentScope[_bitlyLogin] = value;
}
}
private static string GetShortenedUrl(string pageLinkBack) {
if (BitlyLogin.IsEmpty() || BitlyApiKey.IsEmpty()) {
return pageLinkBack;
}
string encodedPageLinkBack = HttpUtility.UrlEncode(pageLinkBack);
string key = "Bitly_pageLinkBack_" + BitlyApiKey + "_" + encodedPageLinkBack;
string shortUrl = WebCache.Get(key) as string;
if (shortUrl != null) {
return shortUrl;
}
string bitlyReq = "http://api.bit.ly/v3/shorten?format=txt&longUrl=" + encodedPageLinkBack + "&login=" + BitlyLogin + "&apiKey=" + BitlyApiKey;
try {
shortUrl = GetWebResponse(bitlyReq);
}
catch (WebException) {
return pageLinkBack;
}
if (shortUrl != null) {
WebCache.Set(key, shortUrl);
return shortUrl;
}
return pageLinkBack;
}
private static string GetWebResponse(string address) {
WebRequest request = WebRequest.Create(address);
request.Method = "GET";
request.Timeout = 5 * 1000; //5 seconds
using (var response = (HttpWebResponse)request.GetResponse()) {
if (response.StatusCode != HttpStatusCode.OK) {
return null;
}
using (Stream stream = response.GetResponseStream()) {
using (MemoryStream memStream = new MemoryStream()) {
stream.CopyTo(memStream);
// Review: Should we use the ContentEncoding from response?
return Encoding.UTF8.GetString(memStream.ToArray());
}
}
}
}
/// <summary>
/// Returns an ordered list of LinkShareSite based on position of "All" parameter occurs in the list.
/// </summary>
/// <remarks>
/// The LinkShareSite is accepted as a params array.
/// In the event that no value is provided or the LinkShareSite.All is the first param, we display all the sites in the order they appear in the enum.
/// If not, the items we look for the first occurence of LinkShareSite.All in the array.
/// The items that appear before this appear in the order they are specified. The All is replaced by all items in the enum that were not already specified by the user
/// in the order they appear in the enum.
/// e.g. sites = [] { Twitter, Facebook, Digg, All }
/// Would result in returning {Twitter, Facebook, Digg, Delicious, GoogleBuzz, Reddit, StumbleUpon}
/// </remarks>
internal static IEnumerable<LinkShareSite> GetSitesInOrder(LinkShareSite[] linkSites) {
var allSites = _allSites.Value;
if (linkSites == null || !linkSites.Any() || linkSites.First() == LinkShareSite.All) {
// Show all sites
return allSites;
}
var result = linkSites.TakeWhile(c => c != LinkShareSite.All).ToList();
if (result.Count != linkSites.Length) {
return Enumerable.Concat(result, allSites.Except(result));
}
else {
return result;
}
}
private static void ConstructPageLinkBack(ref string pageLinkBack, out string shortenedUrl) {
HttpContext context = HttpContext.Current;
if ((pageLinkBack == null) && (context != null)) {
pageLinkBack = context.Request.Url.GetComponents(UriComponents.SchemeAndServer | UriComponents.Path, UriFormat.Unescaped);
}
shortenedUrl = GetShortenedUrl(pageLinkBack);
}
}
@helper GetHtml(string pageTitle,
string pageLinkBack = null,
string twitterUserName = null,
string additionalTweetText = null,
params LinkShareSite[] linkSites) {
if (pageTitle.IsEmpty()) {
throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, CommonResources.Argument_Cannot_Be_Null_Or_Empty, "pageTitle"), "pageTitle");
}
string shortenedUrl;
ConstructPageLinkBack(ref pageLinkBack, out shortenedUrl);
pageLinkBack = HttpUtility.UrlEncode(pageLinkBack);
shortenedUrl = HttpUtility.UrlEncode(shortenedUrl);
pageTitle = HttpUtility.UrlEncode(pageTitle);
foreach (var site in GetSitesInOrder(linkSites)) {
switch (site) {
case LinkShareSite.Delicious:
<a href="http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=@(shortenedUrl)&amp;title=@(pageTitle)" target="_blank" title="Add to del.icio.us">
<img alt="Add to del.icio.us" src="http://www.delicious.com/static/img/delicious.small.gif" style="border:0; height:16px; width:16px; margin:0 1px;" title="Add to del.icio.us" /></a>
break;
case LinkShareSite.Digg:
<a href="http://digg.com/submit?url=@(pageLinkBack)&amp;title=@(pageTitle)" target="_blank" title="Digg!">
<img alt="Digg!" src="http://digg.com/img/badges/16x16-digg-guy.gif" style="border:0; height:16px; width:16px; margin:0 1px;" title="Digg!" /></a>
break;
case LinkShareSite.Facebook:
<a href="http://www.facebook.com/sharer.php?u=@(shortenedUrl)&amp;t=@(pageTitle)" target="_blank" title="Share on Facebook">
<img alt="Share on Facebook" src="http://www.facebook.com/favicon.ico" style="border:0; height:16px; width:16px; margin:0 1px;" title="Share on Facebook" /></a>
break;
case LinkShareSite.Reddit:
<a href="http://reddit.com/submit?url=@(pageLinkBack)&amp;title=@(pageTitle)" target="_blank" title="Reddit!">
<img alt="Reddit!" src="http://www.Reddit.com/favicon.ico" style="border:0; height:16px; width:16px; margin:0 1px;" title="Reddit!" /></a>
break;
case LinkShareSite.StumbleUpon:
<a href="http://www.stumbleupon.com/submit?url=@(pageLinkBack)&amp;title=@(pageTitle)" target="_blank" title="Stumble it!">
<img alt="Stumble it!" src="http://cdn.stumble-upon.com/images/16x16_su_round.gif" style="border:0; height:16px; width:16px; margin:0 1px;" title="Stumble it!" /></a>
break;
case LinkShareSite.GoogleBuzz:
<a href="http://www.google.com/reader/link?url=@(shortenedUrl)&amp;title=@(pageTitle)" target="_blank" title="Share on Google Buzz">
<img alt="Share on Google Buzz" src="http://mail.google.com/mail/pimages/2/up/buzz-icon2.png" style="border:0; height:16px; width:16px; margin:0 1px;" title="Share on Google Buzz" /></a>
break;
case LinkShareSite.Twitter:
string status = String.Empty;
if (!twitterUserName.IsEmpty()) {
status += ", (via @@" + twitterUserName + ")";
}
if (!additionalTweetText.IsEmpty()) {
status += ' ' + additionalTweetText;
}
status = HttpUtility.UrlEncode(status);
<a href="http://twitter.com/home/?status=@(pageTitle)%3a+@(shortenedUrl)@(status)" target="_blank" title="Share on Twitter">
<img alt="Share on Twitter" src="http://twitter.com/favicon.ico" style="border:0; height:16px; width:16px; margin:0 1px;" title="Share on Twitter" />
</a>
break;
}
}
}

View File

@ -0,0 +1,461 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Web.Helpers
{
using System;
using System.Collections.Generic;
#line 3 "..\..\LinkShare.cshtml"
using System.Globalization;
#line default
#line hidden
using System.IO;
using System.Linq;
using System.Net;
#line 4 "..\..\LinkShare.cshtml"
using System.Text;
#line default
#line hidden
using System.Web;
using System.Web.Helpers;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using System.Web.WebPages.Html;
#line 5 "..\..\LinkShare.cshtml"
using System.Web.WebPages.Scope;
#line default
#line hidden
#line 6 "..\..\LinkShare.cshtml"
using Microsoft.Internal.Web.Utils;
#line default
#line hidden
public class LinkShare : System.Web.WebPages.HelperPage
{
#line 8 "..\..\LinkShare.cshtml"
internal static readonly object _bitlyApiKey = new object();
internal static readonly object _bitlyLogin = new object();
private static readonly Lazy<IEnumerable<LinkShareSite>> _allSites = new Lazy<IEnumerable<LinkShareSite>>(() =>
from site in (LinkShareSite[])Enum.GetValues(typeof(LinkShareSite))
where site != LinkShareSite.All
select site
);
public static string BitlyApiKey {
get {
return ScopeStorage.CurrentScope[_bitlyApiKey] as string;
}
set {
if (value == null) {
throw new ArgumentNullException("value");
}
ScopeStorage.CurrentScope[_bitlyApiKey] = value;
}
}
public static string BitlyLogin {
get {
return ScopeStorage.CurrentScope[_bitlyLogin] as string;
}
set {
if (value == null) {
throw new ArgumentNullException("value");
}
ScopeStorage.CurrentScope[_bitlyLogin] = value;
}
}
private static string GetShortenedUrl(string pageLinkBack) {
if (BitlyLogin.IsEmpty() || BitlyApiKey.IsEmpty()) {
return pageLinkBack;
}
string encodedPageLinkBack = HttpUtility.UrlEncode(pageLinkBack);
string key = "Bitly_pageLinkBack_" + BitlyApiKey + "_" + encodedPageLinkBack;
string shortUrl = WebCache.Get(key) as string;
if (shortUrl != null) {
return shortUrl;
}
string bitlyReq = "http://api.bit.ly/v3/shorten?format=txt&longUrl=" + encodedPageLinkBack + "&login=" + BitlyLogin + "&apiKey=" + BitlyApiKey;
try {
shortUrl = GetWebResponse(bitlyReq);
}
catch (WebException) {
return pageLinkBack;
}
if (shortUrl != null) {
WebCache.Set(key, shortUrl);
return shortUrl;
}
return pageLinkBack;
}
private static string GetWebResponse(string address) {
WebRequest request = WebRequest.Create(address);
request.Method = "GET";
request.Timeout = 5 * 1000; //5 seconds
using (var response = (HttpWebResponse)request.GetResponse()) {
if (response.StatusCode != HttpStatusCode.OK) {
return null;
}
using (Stream stream = response.GetResponseStream()) {
using (MemoryStream memStream = new MemoryStream()) {
stream.CopyTo(memStream);
// Review: Should we use the ContentEncoding from response?
return Encoding.UTF8.GetString(memStream.ToArray());
}
}
}
}
/// <summary>
/// Returns an ordered list of LinkShareSite based on position of "All" parameter occurs in the list.
/// </summary>
/// <remarks>
/// The LinkShareSite is accepted as a params array.
/// In the event that no value is provided or the LinkShareSite.All is the first param, we display all the sites in the order they appear in the enum.
/// If not, the items we look for the first occurence of LinkShareSite.All in the array.
/// The items that appear before this appear in the order they are specified. The All is replaced by all items in the enum that were not already specified by the user
/// in the order they appear in the enum.
/// e.g. sites = [] { Twitter, Facebook, Digg, All }
/// Would result in returning {Twitter, Facebook, Digg, Delicious, GoogleBuzz, Reddit, StumbleUpon}
/// </remarks>
internal static IEnumerable<LinkShareSite> GetSitesInOrder(LinkShareSite[] linkSites) {
var allSites = _allSites.Value;
if (linkSites == null || !linkSites.Any() || linkSites.First() == LinkShareSite.All) {
// Show all sites
return allSites;
}
var result = linkSites.TakeWhile(c => c != LinkShareSite.All).ToList();
if (result.Count != linkSites.Length) {
return Enumerable.Concat(result, allSites.Except(result));
}
else {
return result;
}
}
private static void ConstructPageLinkBack(ref string pageLinkBack, out string shortenedUrl) {
HttpContext context = HttpContext.Current;
if ((pageLinkBack == null) && (context != null)) {
pageLinkBack = context.Request.Url.GetComponents(UriComponents.SchemeAndServer | UriComponents.Path, UriFormat.Unescaped);
}
shortenedUrl = GetShortenedUrl(pageLinkBack);
}
#line default
#line hidden
public static System.Web.WebPages.HelperResult GetHtml(string pageTitle,
string pageLinkBack = null,
string twitterUserName = null,
string additionalTweetText = null,
params LinkShareSite[] linkSites) {
return new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 126 "..\..\LinkShare.cshtml"
if (pageTitle.IsEmpty()) {
throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, CommonResources.Argument_Cannot_Be_Null_Or_Empty, "pageTitle"), "pageTitle");
}
string shortenedUrl;
ConstructPageLinkBack(ref pageLinkBack, out shortenedUrl);
pageLinkBack = HttpUtility.UrlEncode(pageLinkBack);
shortenedUrl = HttpUtility.UrlEncode(shortenedUrl);
pageTitle = HttpUtility.UrlEncode(pageTitle);
foreach (var site in GetSitesInOrder(linkSites)) {
switch (site) {
case LinkShareSite.Delicious:
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <a href=\"http://delicious.com/save?v=5&amp;noui&amp;jump=close&am" +
"p;url=");
#line 142 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, shortenedUrl);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "&amp;title=");
#line 142 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, pageTitle);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\" target=\"_blank\" title=\"Add to del.icio.us\">\r\n <img alt=\"Add " +
"to del.icio.us\" src=\"http://www.delicious.com/static/img/delicious.small.gif\" st" +
"yle=\"border:0; height:16px; width:16px; margin:0 1px;\" title=\"Add to del.icio.us" +
"\" /></a>\r\n");
#line 144 "..\..\LinkShare.cshtml"
break;
case LinkShareSite.Digg:
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <a href=\"http://digg.com/submit?url=");
#line 147 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, pageLinkBack);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "&amp;title=");
#line 147 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, pageTitle);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\" target=\"_blank\" title=\"Digg!\">\r\n <img alt=\"Digg!\" src=\"http:" +
"//digg.com/img/badges/16x16-digg-guy.gif\" style=\"border:0; height:16px; width:16" +
"px; margin:0 1px;\" title=\"Digg!\" /></a>\r\n");
#line 149 "..\..\LinkShare.cshtml"
break;
case LinkShareSite.Facebook:
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <a href=\"http://www.facebook.com/sharer.php?u=");
#line 151 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, shortenedUrl);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "&amp;t=");
#line 151 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, pageTitle);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\" target=\"_blank\" title=\"Share on Facebook\">\r\n <img alt=\"Share" +
" on Facebook\" src=\"http://www.facebook.com/favicon.ico\" style=\"border:0; height:" +
"16px; width:16px; margin:0 1px;\" title=\"Share on Facebook\" /></a>\r\n");
#line 153 "..\..\LinkShare.cshtml"
break;
case LinkShareSite.Reddit:
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <a href=\"http://reddit.com/submit?url=");
#line 155 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, pageLinkBack);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "&amp;title=");
#line 155 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, pageTitle);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\" target=\"_blank\" title=\"Reddit!\">\r\n <img alt=\"Reddit!\" src=\"h" +
"ttp://www.Reddit.com/favicon.ico\" style=\"border:0; height:16px; width:16px; marg" +
"in:0 1px;\" title=\"Reddit!\" /></a>\r\n");
#line 157 "..\..\LinkShare.cshtml"
break;
case LinkShareSite.StumbleUpon:
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <a href=\"http://www.stumbleupon.com/submit?url=");
#line 159 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, pageLinkBack);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "&amp;title=");
#line 159 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, pageTitle);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\" target=\"_blank\" title=\"Stumble it!\">\r\n <img alt=\"Stumble it!" +
"\" src=\"http://cdn.stumble-upon.com/images/16x16_su_round.gif\" style=\"border:0; h" +
"eight:16px; width:16px; margin:0 1px;\" title=\"Stumble it!\" /></a>\r\n");
#line 161 "..\..\LinkShare.cshtml"
break;
case LinkShareSite.GoogleBuzz:
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <a href=\"http://www.google.com/reader/link?url=");
#line 163 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, shortenedUrl);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "&amp;title=");
#line 163 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, pageTitle);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, @""" target=""_blank"" title=""Share on Google Buzz"">
<img alt=""Share on Google Buzz"" src=""http://mail.google.com/mail/pimages/2/up/buzz-icon2.png"" style=""border:0; height:16px; width:16px; margin:0 1px;"" title=""Share on Google Buzz"" /></a>
");
#line 165 "..\..\LinkShare.cshtml"
break;
case LinkShareSite.Twitter:
string status = String.Empty;
if (!twitterUserName.IsEmpty()) {
status += ", (via @@" + twitterUserName + ")";
}
if (!additionalTweetText.IsEmpty()) {
status += ' ' + additionalTweetText;
}
status = HttpUtility.UrlEncode(status);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, " <a href=\"http://twitter.com/home/?status=");
#line 175 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, pageTitle);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "%3a+");
#line 175 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, shortenedUrl);
#line default
#line hidden
#line 175 "..\..\LinkShare.cshtml"
WriteTo(@__razor_helper_writer, status);
#line default
#line hidden
WriteLiteralTo(@__razor_helper_writer, "\" target=\"_blank\" title=\"Share on Twitter\">\r\n <img alt=\"Share " +
"on Twitter\" src=\"http://twitter.com/favicon.ico\" style=\"border:0; height:16px; w" +
"idth:16px; margin:0 1px;\" title=\"Share on Twitter\" />\r\n </a>\r\n");
#line 178 "..\..\LinkShare.cshtml"
break;
}
}
#line default
#line hidden
});
}
public LinkShare()
{
}
}
}
#pragma warning restore 1591

View File

@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
namespace Microsoft.Web.Helpers
{
public enum LinkShareSite
{
Delicious,
Digg,
GoogleBuzz,
Facebook,
Reddit,
StumbleUpon,
Twitter,
All
}
}

View File

@ -0,0 +1,385 @@
@* Generator : WebPagesHelper *@
@using System.Diagnostics
@using System.Web.WebPages.Scope
@using System.Web.UI.WebControls
@using System.Globalization
@using Microsoft.Internal.Web.Utils
@functions {
private const string DefaultWidth = "300px";
private const string DefaultHeight = "300px";
private static readonly object _mapIdKey = new object();
private static readonly object _mapQuestApiKey = new object();
private static readonly object _bingApiKey = new object();
private static readonly object _yahooApiKey = new object();
public static string MapQuestApiKey {
get {
return (string)ScopeStorage.CurrentScope[_mapQuestApiKey];
}
set {
ScopeStorage.CurrentScope[_mapQuestApiKey] = value;
}
}
public static string YahooApiKey {
get {
return (string)ScopeStorage.CurrentScope[_yahooApiKey];
}
set {
ScopeStorage.CurrentScope[_yahooApiKey] = value;
}
}
public static string BingApiKey {
get {
return (string)ScopeStorage.CurrentScope[_bingApiKey];
}
set {
ScopeStorage.CurrentScope[_bingApiKey] = value;
}
}
private static int MapId {
get {
var value = (int?)HttpContext.Current.Items[_mapIdKey];
return value ?? 0;
}
set {
HttpContext.Current.Items[_mapIdKey] = value;
}
}
private static string GetMapElementId() {
return "map_" + MapId;
}
private static string TryParseUnit(string value, string defaultValue) {
if (String.IsNullOrEmpty(value)) {
return defaultValue;
}
try {
return Unit.Parse(value, CultureInfo.InvariantCulture).ToString(CultureInfo.InvariantCulture);
} catch (ArgumentException) {
return defaultValue;
}
}
private static IHtmlString RawJS(string text) {
return Raw(HttpUtility.JavaScriptStringEncode(text));
}
private static IHtmlString Raw(string text) {
return new HtmlString(text);
}
private static string GetApiKey(string apiKey, object scopeStorageKey) {
if (apiKey.IsEmpty()) {
return (string)ScopeStorage.CurrentScope[scopeStorageKey];
}
return apiKey;
}
public class MapLocation {
private readonly string _latitude;
private readonly string _longitude;
public MapLocation(string latitude, string longitude) {
_latitude = latitude;
_longitude = longitude;
}
public string Latitude {
get { return _latitude; }
}
public string Longitude {
get { return _longitude; }
}
}
internal static string GetDirectionsQuery(string location, string latitude, string longitude, Func<string, string> encoder = null) {
encoder = encoder ?? HttpUtility.UrlEncode;
Debug.Assert(!(location.IsEmpty() && latitude.IsEmpty() && longitude.IsEmpty()));
if (location.IsEmpty()) {
return encoder(latitude + "," + longitude);
}
return encoder(location);
}
}
@**
Summary:
Generates Html to display a Map Quest map.
Parameter:
key: Map Quest API key
Parameter location:
Address of the location to center the map at
Parameter latitude:
Latitude to center on. If both latitude and longitude are specified, location is ignored.
Parameter longitude:
Longitude to center on. If both latitude and longitude are specified, location is ignored.
Parameter width:
Width of the map with units such as 480px, 100% etc. Defaults to 300px.
Parameter height:
Height of the map with units such as 480px, 100% etc. Defaults to 300px.
Parameter zoom:
Initial zoom level of the map. Defaults to 7.
Parameter type:
Map type to display. Valid values are "map", "sat" or "hyb".
Parameter showDirectionsLink:
Determines if a link to get directions should be displayed when a location is specified. Defaults to true.
Parameter directionsLinkText
The text for the get directions link. Defaults to "Get Directions".
**@
@helper GetMapQuestHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = "300px", string height = "300px", int zoom = 7, string type = "map",
bool showDirectionsLink = true, string directionsLinkText = "Get Directions", bool showZoomControl = true, IEnumerable<MapLocation> pushpins = null) {
key = GetApiKey(key, _mapQuestApiKey);
if (key.IsEmpty()) {
throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key");
}
string mapElement = GetMapElementId();
string loc = "null"; // We want to print the value 'null' in the client
if (latitude != null && longitude != null) {
loc = String.Format(CultureInfo.InvariantCulture, "{{lat: {0}, lng: {1}}}",
HttpUtility.JavaScriptStringEncode(latitude, addDoubleQuotes: false), HttpUtility.JavaScriptStringEncode(longitude, addDoubleQuotes: false));
}
// The MapQuest key listed on their website is Url encoded to begin with.
<script src="http://mapquestapi.com/sdk/js/v6.0.0/mqa.toolkit.js?key=@key" type="text/javascript"></script>
<script type="text/javascript">
MQA.EventUtil.observe(window, 'load', function() {
var map = new MQA.TileMap(document.getElementById('@mapElement'), @zoom, @Raw(loc), '@RawJS(type)');
@if (showZoomControl) {
<text>
MQA.withModule('zoomcontrol3', function() {
map.addControl(new MQA.LargeZoomControl3(), new MQA.MapCornerPlacement(MQA.MapCorner.TOP_LEFT));
});
</text>
}
@if (!String.IsNullOrEmpty(location)) {
<text>
MQA.withModule('geocoder', function() {
map.geocodeAndAddLocations('@RawJS(location)');
});
</text>
}
@if (pushpins != null) {
foreach (var p in pushpins) {
@: map.addShape(new MQA.Poi({lat:@RawJS(p.Latitude),lng:@RawJS(p.Longitude)}));
}
}
});
</script>
<div id="@mapElement" style="width:@TryParseUnit(width, DefaultWidth); height:@TryParseUnit(height, DefaultHeight);">
</div>
if (showDirectionsLink) {
<a class="map-link" href="http://www.mapquest.com/?q=@GetDirectionsQuery(location, latitude, longitude)">@directionsLinkText</a>
}
MapId++;
}
@**
Summary:
Generates Html to display Bing map.
Parameter:
key: Bing Maps application key
Parameter location:
Address of the location to center the map at
Parameter latitude:
Latitude to center on. If both latitude and longitude are specified, location is ignored.
Parameter longitude:
Longitude to center on. If both latitude and longitude are specified, location is ignored.
Parameter width:
Width of the map with units such as 480px, 100% etc. Defaults to 300px.
Parameter height:
Height of the map with units such as 480px, 100% etc. Defaults to 300px.
Parameter zoom:
Initial zoom level of the map. Defaults to 14.
Parameter type:
Map type to display. Valid values are "auto", "aerial", "birdeye", "road" and "mercator".
Parameter showDirectionsLink:
Determines if a link to get directions should be displayed when a location is specified. Defaults to true.
Parameter directionsLinkText
The text for the get directions link. Defaults to "Get Directions".
**@
@helper GetBingHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 14, string type = "auto",
bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable<MapLocation> pushpins = null) {
key = GetApiKey(key, _bingApiKey);
if (key.IsEmpty()) {
throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key");
}
string mapElement = GetMapElementId();
type = (type ?? "auto").ToLowerInvariant();
<script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0" type="text/javascript"></script>
<script type="text/javascript">
jQuery(window).load(function() {
var map = new Microsoft.Maps.Map(document.getElementById("@mapElement"), { credentials: '@RawJS(key)', mapTypeId: Microsoft.Maps.MapTypeId['@RawJS(type)'] });
@if (latitude != null && longitude != null) {
@: map.setView({zoom: @zoom, center: new Microsoft.Maps.Location(@RawJS(latitude), @RawJS(longitude))});
}
else if (location != null) {
<text>
map.getCredentials(function(credentials) {
$.ajax('http://dev.virtualearth.net/REST/v1/Locations/@RawJS(location)', {
data: { output: 'json', key: credentials }, dataType: 'json', jsonp: 'jsonp',
success: function(data) {
if (data && data.resourceSets && data.resourceSets.length > 0 && data.resourceSets[0].resources && data.resourceSets[0].resources.length > 0) {
var r = data.resourceSets[0].resources[0].point.coordinates;
var loc = new Microsoft.Maps.Location(r[0], r[1]);
map.setView({zoom: @zoom, center: loc});
map.entities.push(new Microsoft.Maps.Pushpin(loc, null));
}
}
});
});
</text>
}
@if (pushpins != null) {
foreach(var loc in pushpins) {
@: map.entities.push(new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(@RawJS(loc.Latitude), @RawJS(loc.Longitude)), null));
}
}
});
</script>
<div class="map" id="@mapElement" style="position:relative; width:@TryParseUnit(width, DefaultWidth); height:@TryParseUnit(height, DefaultHeight);">
</div>
if (showDirectionsLink) {
// Review: Need to figure out if the link needs to be localized.
<a class="map-link" href="http://www.bing.com/maps/?v=2&where1=@GetDirectionsQuery(location, latitude, longitude)">@directionsLinkText</a>
}
MapId++;
}
@**
Summary:
Generates Html to display a Google map.
Parameter location:
Address of the location to center the map at
Parameter latitude:
Latitude to center on. If both latitude and longitude are specified, location is ignored.
Parameter longitude:
Longitude to center on. If both latitude and longitude are specified, location is ignored.
Parameter width:
Width of the map with units such as 480px, 100% etc. Defaults to 300px.
Parameter height:
Height of the map with units such as 480px, 100% etc. Defaults to 300px.
Parameter zoom:
Initial zoom level of the map. Defaults to 14.
Parameter type:
Map type to display. Valid values are "ROADMAP", "HYBRID", "SATELLITE" and "TERRAIN".
Parameter showDirectionsLink:
Determines if a link to get directions should be displayed when a location is specified. Defaults to true.
Parameter directionsLinkText
The text for the get directions link. Defaults to "Get Directions".
**@
@helper GetGoogleHtml(string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 14, string type = "ROADMAP",
bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable<MapLocation> pushpins = null) {
string mapElement = GetMapElementId();
type = (type ?? "ROADMAP").ToUpperInvariant(); // Map types are in upper case
// Google maps does not support null centers. We'll set it to arbitrary values if they are null and only the location is provided.
// These locations are somewhere around Microsoft's Redmond Campus.
latitude = latitude ?? "47.652437";
longitude = longitude ?? "-122.132424";
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var map = new google.maps.Map(document.getElementById("@mapElement"), { zoom: @zoom, center: new google.maps.LatLng(@RawJS(latitude), @RawJS(longitude)), mapTypeId: google.maps.MapTypeId['@RawJS(type)'] });
@if (!String.IsNullOrEmpty(location)) {
<text>
new google.maps.Geocoder().geocode({address: '@RawJS(location)'}, function(response, status) {
if (status === google.maps.GeocoderStatus.OK) {
var best = response[0].geometry.location;
map.panTo(best);
new google.maps.Marker({map : map, position: best });
}
});
</text>
}
@if (pushpins != null) {
foreach(var loc in pushpins) {
@: new google.maps.Marker({map : map, position: new google.maps.LatLng(@RawJS(loc.Latitude), @RawJS(loc.Longitude))});
}
}
});
</script>
<div class="map" id="@mapElement" style="width:@TryParseUnit(width, DefaultWidth); height:@TryParseUnit(height, DefaultHeight);">
</div>
if (showDirectionsLink) {
<a class="map-link" href="http://maps.google.com/maps?q=@GetDirectionsQuery(location, latitude, longitude)">@directionsLinkText</a>
}
MapId++;
}
@**
Summary:
Generates Html to display a Yahoo map.
Parameter:
key: Yahoo application ID
Parameter location:
Address of the location to center the map at
Parameter latitude:
Latitude to center on. If both latitude and longitude are specified, location is ignored.
Parameter longitude:
Longitude to center on. If both latitude and longitude are specified, location is ignored.
Parameter width:
Width of the map with units such as 480px, 100% etc. Defaults to 300px.
Parameter height:
Height of the map with units such as 480px, 100% etc. Defaults to 300px.
Parameter zoom:
Initial zoom level of the map. Defaults to 4.
Parameter type:
Map type to display. Valid values are "YAHOO_MAP_SAT", "YAHOO_MAP_HYB" and "YAHOO_MAP_REG".
Parameter showDirectionsLink:
Determines if a link to get directions should be displayed when a location is specified. Defaults to true.
Parameter directionsLinkText
The text for the get directions link. Defaults to "Get Directions".
**@
@helper GetYahooHtml(string key = null, string location = null, string latitude = null, string longitude = null, string width = null, string height = null, int zoom = 4, string type = "YAHOO_MAP_REG",
bool showDirectionsLink = true, string directionsLinkText = "Get Directions", IEnumerable<MapLocation> pushpins = null) {
key = GetApiKey(key, _yahooApiKey);
if (key.IsEmpty()) {
throw new ArgumentException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "key");
}
string mapElement = GetMapElementId();
<script src="http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=@HttpUtility.UrlEncode(key)" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var map = new YMap(document.getElementById('@RawJS(mapElement)'));
map.addTypeControl();
map.setMapType(@RawJS(type));
@if (latitude != null && longitude != null) {
@: map.drawZoomAndCenter(new YGeoPoint(@RawJS(latitude), @RawJS(longitude)), @zoom);
}
else if (!String.IsNullOrEmpty(location)) {
@: map.drawZoomAndCenter('@RawJS(location)', @zoom);
}
else {
@: map.setZoomLevel(@zoom);
}
@if(pushpins != null) {
foreach (var loc in pushpins) {
@: map.addMarker(new YGeoPoint(@RawJS(loc.Latitude), @RawJS(loc.Longitude)));
}
}
});
</script>
<div id="@mapElement" style="width:@TryParseUnit(width, DefaultWidth); height:@TryParseUnit(height, DefaultHeight);">
</div>
if (showDirectionsLink) {
<a class="map-link" href="http://maps.yahoo.com/#q1=@GetDirectionsQuery(location, latitude, longitude, HttpUtility.UrlPathEncode)">@directionsLinkText</a>
}
MapId++;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory),Runtime.sln))\tools\WebStack.settings.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<CodeAnalysis Condition=" '$(CodeAnalysis)' == '' ">false</CodeAnalysis>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0C7CE809-0F72-4C19-8C64-D6573E4D9521}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Web.Helpers</RootNamespace>
<AssemblyName>Microsoft.Web.Helpers</AssemblyName>
<FileAlignment>512</FileAlignment>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<OutputType>Library</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;ASPNETWEBPAGES</DefineConstants>
<CodeAnalysisRuleSet>..\WebHelpers.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\bin\Release\</OutputPath>
<DefineConstants>TRACE;ASPNETWEBPAGES</DefineConstants>
<CodeAnalysisRuleSet>..\WebHelpers.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>$(CodeAnalysis)</RunCodeAnalysis>
<DocumentationFile>$(OutputPath)\$(AssemblyName).xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'CodeCoverage|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\bin\CodeCoverage\</OutputPath>
<DefineConstants>TRACE;DEBUG;CODE_COVERAGE;ASPNETWEBPAGES</DefineConstants>
<DebugType>full</DebugType>
<CodeAnalysisRuleSet>..\WebHelpers.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="..\CodeAnalysisDictionary.xml" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\CommonResources.Designer.cs">
<Link>Common\CommonResources.Designer.cs</Link>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>CommonResources.resx</DependentUpon>
</Compile>
<Compile Include="..\TransparentCommonAssemblyInfo.cs">
<Link>Properties\TransparentCommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Analytics.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Analytics.cshtml</DependentUpon>
</Compile>
<Compile Include="Bing.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Bing.cshtml</DependentUpon>
</Compile>
<Compile Include="Facebook.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Facebook.cshtml</DependentUpon>
</Compile>
<Compile Include="FileUpload.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>FileUpload.cshtml</DependentUpon>
</Compile>
<Compile Include="GamerCard.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>GamerCard.cshtml</DependentUpon>
</Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="LinkShare.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>LinkShare.cshtml</DependentUpon>
</Compile>
<Compile Include="Maps.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Maps.cshtml</DependentUpon>
</Compile>
<Compile Include="ReCaptcha.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>ReCaptcha.cshtml</DependentUpon>
</Compile>
<Compile Include="..\GlobalSuppressions.cs">
<Link>Common\GlobalSuppressions.cs</Link>
</Compile>
<Compile Include="Gravatar.cs" />
<Compile Include="GravatarRating.cs" />
<Compile Include="PreApplicationStartCode.cs" />
<Compile Include="Resources\HelpersToolkitResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>HelpersToolkitResources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Themes.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Twitter.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Twitter.cshtml</DependentUpon>
</Compile>
<Compile Include="Video.cs" />
<Compile Include="VirtualPathUtilityBase.cs" />
<Compile Include="VirtualPathUtilityWrapper.cs" />
<Compile Include="UrlBuilder.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\CommonResources.resx">
<Link>Common\CommonResources.resx</Link>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>CommonResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\HelpersToolkitResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>HelpersToolkitResources.Designer.cs</LastGenOutput>
<CustomToolNamespace>Resources</CustomToolNamespace>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\System.Web.Helpers\System.Web.Helpers.csproj">
<Project>{9B7E3740-6161-4548-833C-4BBCA43B970E}</Project>
<Name>System.Web.Helpers</Name>
</ProjectReference>
<ProjectReference Include="..\System.Web.Razor\System.Web.Razor.csproj">
<Project>{8F18041B-9410-4C36-A9C5-067813DF5F31}</Project>
<Name>System.Web.Razor</Name>
</ProjectReference>
<ProjectReference Include="..\System.Web.WebPages.Razor\System.Web.WebPages.Razor.csproj">
<Project>{0939B11A-FE4E-4BA1-8AD6-D97741EE314F}</Project>
<Name>System.Web.WebPages.Razor</Name>
</ProjectReference>
<ProjectReference Include="..\System.Web.WebPages\System.Web.WebPages.csproj">
<Project>{76EFA9C5-8D7E-4FDF-B710-E20F8B6B00D2}</Project>
<Name>System.Web.WebPages</Name>
</ProjectReference>
<ProjectReference Include="..\WebMatrix.Data\WebMatrix.Data.csproj">
<Project>{4D39BAAF-8A96-473E-AB79-C8A341885137}</Project>
<Name>WebMatrix.Data</Name>
</ProjectReference>
<ProjectReference Include="..\WebMatrix.WebData\WebMatrix.WebData.csproj">
<Project>{55A15F40-1435-4248-A7F2-2A146BB83586}</Project>
<Name>WebMatrix.WebData</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Analytics.cshtml">
<CustomToolNamespace>Microsoft.Web.Helpers</CustomToolNamespace>
<Generator>RazorGenerator</Generator>
<LastGenOutput>Analytics.generated.cs</LastGenOutput>
</None>
<None Include="Bing.cshtml">
<Generator>RazorGenerator</Generator>
<CustomToolNamespace>Microsoft.Web.Helpers</CustomToolNamespace>
<LastGenOutput>Bing.generated.cs</LastGenOutput>
</None>
<None Include="FileUpload.cshtml">
<CustomToolNamespace>Microsoft.Web.Helpers</CustomToolNamespace>
<Generator>RazorGenerator</Generator>
<LastGenOutput>FileUpload.generated.cs</LastGenOutput>
</None>
<None Include="GamerCard.cshtml">
<CustomToolNamespace>Microsoft.Web.Helpers</CustomToolNamespace>
<Generator>RazorGenerator</Generator>
<LastGenOutput>GamerCard.generated.cs</LastGenOutput>
</None>
<None Include="LinkShare.cshtml">
<CustomToolNamespace>Microsoft.Web.Helpers</CustomToolNamespace>
<Generator>RazorGenerator</Generator>
<LastGenOutput>LinkShare.generated.cs</LastGenOutput>
</None>
<Compile Include="LinkShareSite.cs">
<CustomToolNamespace>Microsoft.Web.Helpers</CustomToolNamespace>
</Compile>
<None Include="ReCaptcha.cshtml">
<CustomToolNamespace>Microsoft.Web.Helpers</CustomToolNamespace>
<Generator>RazorGenerator</Generator>
<LastGenOutput>ReCaptcha.generated.cs</LastGenOutput>
</None>
<None Include="Twitter.cshtml">
<CustomToolNamespace>Microsoft.Web.Helpers</CustomToolNamespace>
<Generator>RazorGenerator</Generator>
<LastGenOutput>Twitter.generated.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Facebook.cshtml">
<Generator>RazorGenerator</Generator>
<CustomToolNamespace>Microsoft.Web.Helpers</CustomToolNamespace>
<LastGenOutput>Facebook.generated.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Maps.cshtml">
<Generator>RazorGenerator</Generator>
<CustomToolNamespace>Microsoft.Web.Helpers</CustomToolNamespace>
<LastGenOutput>Maps.generated.cs</LastGenOutput>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System.ComponentModel;
using System.Web.WebPages.Razor;
namespace Microsoft.Web.Helpers
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class PreApplicationStartCode
{
private static bool _startWasCalled;
public static void Start()
{
// Even though ASP.NET will only call each PreAppStart once, we sometimes internally call one PreAppStart from
// another PreAppStart to ensure that things get initialized in the right order. ASP.NET does not guarantee the
// order so we have to guard against multiple calls.
// All Start calls are made on same thread, so no lock needed here.
if (_startWasCalled)
{
return;
}
_startWasCalled = true;
// Auto import the Microsoft.Web.Helpers namespace to all apps that are executing.
WebPageRazorHost.AddGlobalImport(typeof(PreApplicationStartCode).Namespace);
}
}
}

Some files were not shown because too many files have changed in this diff Show More