本文整理汇总了C#中Site类的典型用法代码示例。如果您正苦于以下问题:C# Site类的具体用法?C# Site怎么用?C# Site使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Site类属于命名空间,在下文中一共展示了Site类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DynamicRenderDocument
public DynamicRenderDocument(DocumentFile document, LayoutFile layout, Site site)
: base(document.SourceRelativePath)
{
_document = document;
_layout = layout;
_site = site;
}
示例2: CheckPages
public IEnumerable<Site.SpellcheckResult> CheckPages(Guid siteId, IEnumerable<Guid> pageIds, Site.SpellcheckConfigurations configurations)
{
var results = new List<Site.SpellcheckResult>();
foreach (var pageId in pageIds)
{
var page = _blobs.Get<PageProfile>(new BlobReference(siteId, pageId));
var config = configurations.GetFor(page.Url);
if (config == null) continue;
var spellchecker = _spellcheckerFactory.CreateFor(config.PrimaryLanguageKey, config.SecondaryLanguageKey);
var result = spellchecker.Check(page.Text);
if (result.HasData)
{
results.Add(new Site.SpellcheckResult
{
PageId = pageId,
ConfirmedMisspellings = result.Misspellings,
PotentialMisspellings = result.PotentialMisspellings,
SiteId = siteId
});
}
}
return results;
}
示例3: DynamicPaginator
public DynamicPaginator(DocumentFile activeDocument, Paginator Paginator, Site site)
: base(null)
{
this.ActiveDocument = activeDocument;
this.Paginator = Paginator;
this.Site = site;
}
示例4: AuthenticateUser
/// <summary>
/// Try to authenticate the user with username & password
/// </summary>
/// <param name="site"></param>
/// <param name="email"></param>
/// <param name="password"></param>
/// <param name="ipAddress"></param>
/// <param name="createPersistentCookie"></param>
/// <returns></returns>
public User AuthenticateUser(Site site, string email, string password, string ipAddress, bool createPersistentCookie)
{
string hashedPassword = password.EncryptToSHA2();
if (site == null)
{
const string msg = "FormsAuthenticationService.AuthenticateUser invoked with Site = NULL";
log.Error(msg);
throw new ApplicationException(msg);
}
try
{
User user = userService.GetUserByEmailAndPassword(site, email, hashedPassword);
if (user != null)
{
LogIn(user, ipAddress, createPersistentCookie);
}
else
{
log.WarnFormat("Invalid username-password combination: {0}:{1} on SiteId = {2}", email, password, site.SiteId.ToString());
}
return user;
}
catch (Exception ex)
{
log.ErrorFormat("An error occured while logging in user {0} on SiteId = {1}", email, site.SiteId.ToString());
throw new Exception(String.Format("Unable to log in user '{0}': " + ex.Message, email), ex);
}
}
示例5: SetFeaturesForSite
public void SetFeaturesForSite(Site site)
{
if (site.Features.Count > 0)
{
log.WarnFormat("Can't add Features to siteid {0} because it already has {1} features", site.SiteId.ToString(), site.Features.Count.ToString());
throw new ApplicationException("Site already has features!");
}
IList<Feature> features = FindAll();
foreach (Feature feature in features)
{
SiteFeature sf = new SiteFeature()
{
Site = site,
Feature = feature,
Enabled = false,
StartDate = DateTime.Now.ToUniversalTime(),
EndDate = null
};
site.Features.Add(sf);
}
siteService.SaveSite(site);
}
示例6: getPoolSources
/// <summary>
/// Get a ConnectionsPoolsSource given a SiteTable using the factory's default pool source
/// </summary>
/// <param name="sources">SiteTable</param>
/// <returns>ConnectionPoolsSource</returns>
public override object getPoolSources(object sources)
{
if (!(sources is SiteTable))
{
throw new ArgumentException("Invalid source. Must supply a SiteTable");
}
SiteTable siteTable = (SiteTable)sources;
Site[] sites = new Site[siteTable.Sites.Count];
for (int i = 0; i < siteTable.Sites.Count; i++)
{
sites[i] = (Site)siteTable.Sites.GetByIndex(i);
}
ConnectionPoolsSource result = new ConnectionPoolsSource();
result.CxnSources = new Dictionary<string, ConnectionPoolSource>();
foreach (Site site in sites)
{
if (site.Sources == null || site.Sources.Length == 0)
{
continue;
}
for (int i = 0; i < site.Sources.Length; i++)
{
if (String.Equals(site.Sources[i].Protocol, "VISTA", StringComparison.CurrentCultureIgnoreCase)
|| String.Equals(site.Sources[i].Protocol, "PVISTA", StringComparison.CurrentCultureIgnoreCase))
{
result.CxnSources.Add(site.Id, (ConnectionPoolSource)getPoolSource(site.Sources[i]));
break;
}
}
}
return result;
}
示例7: SiteWithConfig
public SiteWithConfig()
{
Site = new Site();
SiteConfig = new SiteConfig();
AppSettings = new Hashtable();
DiagnosticsSettings = new DiagnosticsSettings();
}
示例8: DynamicDocumentFile
public DynamicDocumentFile(DocumentFile activeDocument, DocumentFile document, Site site)
: base(document)
{
this.ActiveDocument = activeDocument;
this.Document = document;
this.Site = site;
}
示例9: Generate
public string Generate(Site site)
{
StringBuilder sb = new StringBuilder();
DateTime pubDate = (DateTime)site.Content.Select(x => x.LastUpdate).Max();
sb.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
sb.AppendLine("<rss version=\"2.0\">");
sb.AppendLine("\t<channel>");
sb.AppendLine("\t<title>The Blog of Zachary Snow</title>");
sb.AppendLine("\t<description>The Blog of Zachary Snow</description>");
sb.AppendLine("\t<link>http://www.zacharysnow.net/</link>");
sb.AppendLine("\t<lastBuildDate>" + DateTime.Now.ToString("r") + "</lastBuildDate>");
sb.AppendLine("\t<pubDate>" + pubDate.ToString("r") + "</pubDate>");
sb.AppendLine("\t<ttl>1800</ttl>");
foreach (var post in site.Posts.Take(20))
{
sb.AppendLine("\t<item>");
sb.AppendLine("\t\t<title><![CDATA[" + post.Title + "]]></title>");
sb.AppendLine("\t\t<description><![CDATA[" + post.Excerpt + "]]></description>");
sb.AppendLine("\t\t<link>http://www.zacharysnow.net/" + post.Permalink + "</link>");
sb.AppendLine("\t\t<guid>http://www.zacharysnow.net/" + post.Permalink + "</guid>");
sb.AppendLine("\t\t<pubDate>" + post.Date.ToString("r") + "</pubDate>");
sb.AppendLine("\t</item>");
}
sb.AppendLine("\t</channel>");
sb.AppendLine("</rss>");
sb.AppendLine();
return sb.ToString();
}
示例10: AddUserVisitorGroup
/// <summary>
///
/// </summary>
/// <param name="ctx"></param>
/// <param name="site"></param>
/// <param name="name"></param>
public void AddUserVisitorGroup(ClientContext ctx, Site site, string name)
{
if(string.IsNullOrWhiteSpace(name))
{
//TODO LOG
}
}
示例11: DeploySearchConfiguration
private void DeploySearchConfiguration(object modelHost, Site site, SearchConfigurationDefinition definition)
{
var context = site.Context;
var conf = new SearchConfigurationPortability(context);
var owner = new SearchObjectOwner(context, SearchObjectLevel.SPSite);
InvokeOnModelEvent(this, new ModelEventArgs
{
CurrentModelNode = null,
Model = null,
EventType = ModelEventType.OnProvisioning,
Object = conf,
ObjectType = typeof(SearchConfigurationPortability),
ObjectDefinition = definition,
ModelHost = modelHost
});
conf.ImportSearchConfiguration(owner, definition.SearchConfiguration);
InvokeOnModelEvent(this, new ModelEventArgs
{
CurrentModelNode = null,
Model = null,
EventType = ModelEventType.OnProvisioned,
Object = conf,
ObjectType = typeof(SearchConfigurationPortability),
ObjectDefinition = definition,
ModelHost = modelHost
});
context.ExecuteQueryWithTrace();
}
示例12: CloneAndSendLocal
void CloneAndSendLocal(TransportMessage messageToDispatch, Site destinationSite)
{
//todo - do we need to clone? check with Jonathan O
messageToDispatch.Headers[Headers.DestinationSites] = destinationSite.Key;
MessageSender.Send(messageToDispatch, InputAddress);
}
示例13: Generate
private string Generate(Site site)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
sb.AppendLine("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">");
foreach (var post in site.Posts)
{
sb.AppendLine("\t<url>");
sb.AppendLine("\t\t<loc>http://zacharysnow.net/" + post.Permalink + "</loc>");
sb.AppendLine("\t</url>");
}
foreach (var page in site.Pages)
{
sb.AppendLine("\t<url>");
sb.AppendLine("\t\t<loc>http://zacharysnow.net/" + page.Permalink + "</loc>");
sb.AppendLine("\t</url>");
}
foreach (var page in site.GeneratorPages.Where(x => x.Data.IsRedirect != true))
{
sb.AppendLine("\t<url>");
sb.AppendLine("\t\t<loc>http://zacharysnow.net/" + page.Permalink + "</loc>");
sb.AppendLine("\t</url>");
}
sb.AppendLine("</urlset>");
sb.AppendLine();
return sb.ToString();
}
示例14: Test_AddSubSite_ChildSites
public void Test_AddSubSite_ChildSites()
{
var sampleSite = new Site("SampleSite");
var cnSubSite = new Site(sampleSite, "cn")
{
Bindings = new[] {
new Binding(){
Domain = "192.168.1.1",
SitePath = "cn"
}
}
};
siteProvider.Add(cnSubSite);
var childSites = siteProvider.ChildSites(sampleSite);
Assert.AreEqual(1, childSites.Count());
var actualSubSite = siteProvider.Get(cnSubSite);
Assert.AreEqual("SampleSite~cn", actualSubSite.AbsoluteName);
Assert.AreEqual("192.168.1.1", actualSubSite.Bindings[0].Domain);
Assert.AreEqual("cn", actualSubSite.Bindings[0].SitePath);
siteProvider.Remove(cnSubSite);
}
示例15: SiteDownloadContext
public SiteDownloadContext(Site site, DownloadOptions options, IList<PageLevel> downloadedPages, Queue<PageLevel> downloadQueue)
{
this.Site = site;
this.Options = options;
this.DownloadedPages = downloadedPages ?? new List<PageLevel>();
this.DownloadQueue = downloadQueue ?? new Queue<PageLevel>();
}